public void services_are_imported() { var library1 = new HtmlConventionLibrary(); library1.RegisterService<IFoo, LittleFoo>(); var library2 = new HtmlConventionLibrary(); library2.RegisterService<IFoo, BigFoo>("different"); library1.Import(library2); library1.Get<IFoo>().ShouldBeType<LittleFoo>(); library1.Get<IFoo>("different").ShouldBeType<BigFoo>(); }
public void services_are_imported() { var library1 = new HtmlConventionLibrary(); library1.RegisterService <IFoo, LittleFoo>(); var library2 = new HtmlConventionLibrary(); library2.RegisterService <IFoo, BigFoo>("different"); library1.Import(library2); library1.Get <IFoo>().ShouldBeOfType <LittleFoo>(); library1.Get <IFoo>("different").ShouldBeOfType <BigFoo>(); }
public void if_not_explicitly_specified_assume_the_profile_is_default() { var library = new HtmlConventionLibrary(); library.RegisterService<IFoo, Foo>(TagConstants.Default); library.Get<IFoo>().ShouldBeOfType<Foo>(); }
public void fetching_by_profile_should_fall_back_to_default_if_not_specific_implementation_is_used() { var library = new HtmlConventionLibrary(); library.RegisterService<IFoo, Foo>(TagConstants.Default); library.Get<IFoo>("Profile1").ShouldBeOfType<Foo>(); }
public void if_not_explicitly_specified_assume_the_profile_is_default() { var library = new HtmlConventionLibrary(); library.RegisterService <IFoo, Foo>(TagConstants.Default); library.Get <IFoo>().ShouldBeOfType <Foo>(); }
public void simple_registration_of_service_by_type() { var library = new HtmlConventionLibrary(); library.RegisterService <IFoo, Foo>(); library.Get <IFoo>().ShouldBeOfType <Foo>(); }
public void fetching_by_profile_should_fall_back_to_default_if_not_specific_implementation_is_used() { var library = new HtmlConventionLibrary(); library.RegisterService <IFoo, Foo>(TagConstants.Default); library.Get <IFoo>("Profile1").ShouldBeOfType <Foo>(); }
public void register_and_build_by_profile() { var library = new HtmlConventionLibrary(); library.RegisterService <IFoo, Foo>(TagConstants.Default); library.RegisterService <IFoo, DifferentFoo>("Profile1"); library.Get <IFoo>("Profile1").ShouldBeOfType <DifferentFoo>(); }
public void registration_of_service_by_func() { var library = new HtmlConventionLibrary(); library.RegisterService <IFoo>(() => new ColoredFoo { Color = "Red" }); library.Get <IFoo>().ShouldBeOfType <ColoredFoo>() .Color.ShouldEqual("Red"); }
public void services_are_not_overwritten_while_importing() { var library1 = new HtmlConventionLibrary(); library1.RegisterService<IFoo, LittleFoo>(); var library2 = new HtmlConventionLibrary(); library2.RegisterService<IFoo, BigFoo>(); library1.Import(library2); library1.Get<IFoo>().ShouldBeType<LittleFoo>(); }
public FormLineExpression <T> Build(Expression <Func <T, object> > expression, T model = null) { var request = new ElementRequest(expression.ToAccessor()) { Model = model ?? _request.Get <T>() }; var accessRight = _fieldAccessService.RightsFor(request); var chrome = _library.Get <IFieldChrome>(_profile.Name); return(new FormLineExpression <T>(chrome, _generator, request).Access(accessRight)); }
public void services_are_not_overwritten_while_importing() { var library1 = new HtmlConventionLibrary(); library1.RegisterService <IFoo, LittleFoo>(); var library2 = new HtmlConventionLibrary(); library2.RegisterService <IFoo, BigFoo>(); library1.Import(library2); library1.Get <IFoo>().ShouldBeOfType <LittleFoo>(); }
public void simple_registration_of_service_by_type() { var library = new HtmlConventionLibrary(); library.RegisterService<IFoo, Foo>(); library.Get<IFoo>().ShouldBeType<Foo>(); }
public void register_and_build_by_profile() { var library = new HtmlConventionLibrary(); library.RegisterService<IFoo, Foo>(TagConstants.Default); library.RegisterService<IFoo, DifferentFoo>("Profile1"); library.Get<IFoo>("Profile1").ShouldBeType<DifferentFoo>(); }
public void registration_of_service_by_func() { var library = new HtmlConventionLibrary(); library.RegisterService<IFoo>(() => new ColoredFoo{Color = "Red"}); library.Get<IFoo>().ShouldBeType<ColoredFoo>() .Color.ShouldEqual("Red"); }