コード例 #1
0
ファイル: ServiceBuilderTests.cs プロジェクト: sinxiaji/Aoite
        public void Set_Test()
        {
            var locator = new IocContainer();

            using (var builder = new ServiceBuilder(locator))
            {
                var binder = builder.Use(DefineTypes.String);
                Assert.IsType <TypeServiceBinder>(binder);
                Assert.True(binder.Overwrite);
                Assert.Equal(DefineTypes.String, binder.ExpectType);
                Assert.Equal(binder, builder.TypeBinders.Value[0]);

                var binder2 = builder.Use("abc");
                Assert.IsType <ValueServiceBinder>(binder2);
                Assert.Equal("abc", binder2.Name);
                Assert.Null(binder2.ExpectType);
                Assert.Equal(binder2, builder.ValueBinders.Value[0]);


                var binder3 = builder.Use(DefineTypes.String, "abc");
                Assert.IsType <ValueServiceBinder>(binder3);
                Assert.Equal("abc", binder3.Name);
                Assert.Equal(DefineTypes.String, binder3.ExpectType);
                Assert.Equal(binder3, builder.ValueBinders.Value[1]);
            }
        }
コード例 #2
0
        public void Set_Test()
        {
            var locator = new IocContainer();
            using(var builder = new ServiceBuilder(locator))
            {
                var binder = builder.Use(Types.String);
                Assert.IsType<TypeServiceBinder>(binder);
                Assert.True(binder.Overwrite);
                Assert.Equal(Types.String, binder.ExpectType);
                Assert.Equal(binder, builder.TypeBinders.Value[0]);

                var binder2 = builder.Use("abc");
                Assert.IsType<ValueServiceBinder>(binder2);
                Assert.Equal("abc", binder2.Name);
                Assert.Null(binder2.ExpectType);
                Assert.Equal(binder2, builder.ValueBinders.Value[0]);


                var binder3 = builder.Use(Types.String, "abc");
                Assert.IsType<ValueServiceBinder>(binder3);
                Assert.Equal("abc", binder3.Name);
                Assert.Equal(Types.String, binder3.ExpectType);
                Assert.Equal(binder3, builder.ValueBinders.Value[1]);
            }
        }
コード例 #3
0
 public void Create_Test()
 {
     var locator = new IocContainer();
     using(var builder = new ServiceBuilder(locator))
     {
         builder.Promote();
         Assert.True(builder.IsPromote);
     }
 }
コード例 #4
0
ファイル: ServiceBuilderTests.cs プロジェクト: sinxiaji/Aoite
        public void Create_Test()
        {
            var locator = new IocContainer();

            using (var builder = new ServiceBuilder(locator))
            {
                builder.Promote();
                Assert.True(builder.IsPromote);
            }
        }
コード例 #5
0
 public void Add_Test()
 {
     var locator = new IocContainer();
     using(var builder = new ServiceBuilder(locator))
     {
         var binder = builder.UseRange(Types.String);
         Assert.IsType<TypeServiceBinder>(binder);
         Assert.False(binder.Overwrite);
         Assert.Equal(Types.String, binder.ExpectType);
         Assert.Equal(binder, builder.TypeBinders.Value[0]);
     }
 }
コード例 #6
0
ファイル: ServiceBuilderTests.cs プロジェクト: sinxiaji/Aoite
        public void Add_Test()
        {
            var locator = new IocContainer();

            using (var builder = new ServiceBuilder(locator))
            {
                var binder = builder.UseRange(DefineTypes.String);
                Assert.IsType <TypeServiceBinder>(binder);
                Assert.False(binder.Overwrite);
                Assert.Equal(DefineTypes.String, binder.ExpectType);
                Assert.Equal(binder, builder.TypeBinders.Value[0]);
            }
        }
コード例 #7
0
 public ValueServiceBinder(IocContainer container, ServiceBuilder builder, Type expectType, string name)
     : base(container, builder, expectType)
 {
     this._name = name;
 }
コード例 #8
0
 public TypeServiceBinderTests()
 {
     this._locator = new IocContainer();
     this._builder = new ServiceBuilder(this._locator);
 }
コード例 #9
0
 public ValueServiceBinder(IocContainer container, ServiceBuilder builder, Type expectType, string name)
     : base(container, builder, expectType)
 {
     this._name = name;
 }
コード例 #10
0
 public TypeServiceBinderTests()
 {
     this._locator = new IocContainer();
     this._builder = new ServiceBuilder(this._locator);
 }
コード例 #11
0
 public TypeServiceBinder(IocContainer container, ServiceBuilder builder, Type expectType, bool overwrite)
     : base(container, builder, expectType)
 {
     this._overwrite = overwrite;
 }
コード例 #12
0
ファイル: IServiceBinder.cs プロジェクト: supuy-ruby/Aoite
 public ServiceBinderBase(IocContainer container, ServiceBuilder builder, Type expectType)
 {
     this._container = container;
     this._builder = builder;
     this._expectType = expectType;
 }
コード例 #13
0
ファイル: ITypeServiceBinder.cs プロジェクト: yufengfei/Aoite
 public TypeServiceBinder(IocContainer container, ServiceBuilder builder, Type expectType, bool overwrite)
     : base(container, builder, expectType)
 {
     this._overwrite = overwrite;
 }
コード例 #14
0
 public ServiceBinderBase(IocContainer container, ServiceBuilder builder, Type expectType)
 {
     this._container  = container;
     this._builder    = builder;
     this._expectType = expectType;
 }