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]); } }
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]); } }
public void Create_Test() { var locator = new IocContainer(); using(var builder = new ServiceBuilder(locator)) { builder.Promote(); Assert.True(builder.IsPromote); } }
public void Create_Test() { var locator = new IocContainer(); using (var builder = new ServiceBuilder(locator)) { builder.Promote(); Assert.True(builder.IsPromote); } }
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]); } }
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]); } }
public ValueServiceBinder(IocContainer container, ServiceBuilder builder, Type expectType, string name) : base(container, builder, expectType) { this._name = name; }
public TypeServiceBinderTests() { this._locator = new IocContainer(); this._builder = new ServiceBuilder(this._locator); }
public TypeServiceBinder(IocContainer container, ServiceBuilder builder, Type expectType, bool overwrite) : base(container, builder, expectType) { this._overwrite = overwrite; }
public ServiceBinderBase(IocContainer container, ServiceBuilder builder, Type expectType) { this._container = container; this._builder = builder; this._expectType = expectType; }