public void register_with_basic_authentication_disabled()
        {
            var registry = new FubuRegistry();
            registry.Import<Saml2Extensions>();
            registry.Import<ApplyAuthentication>();

            var samlCertificateRepository = MockRepository.GenerateMock<ISamlCertificateRepository>();
            samlCertificateRepository.Stub(x => x.AllKnownCertificates()).Return(new SamlCertificate[0]);

            registry.Services(x =>
            {
                x.SetServiceIfNone<IPrincipalBuilder>(MockRepository.GenerateMock<IPrincipalBuilder>());
                x.AddService<ISamlResponseHandler>(MockRepository.GenerateMock<ISamlResponseHandler>());
                x.SetServiceIfNone<ISamlCertificateRepository>(samlCertificateRepository);
            });

            registry.AlterSettings<AuthenticationSettings>(x => {
                x.MembershipEnabled = MembershipStatus.Disabled;
            });

            var container = new Container();
            var runtime = FubuApplication.For(registry).StructureMap(container).Bootstrap();


            var strategies = container.GetAllInstances<IAuthenticationStrategy>();
            strategies.Single().ShouldBeOfType<SamlAuthenticationStrategy>();

        }
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeType<NothingEndpoint>(); // Have to do this to make it an isolated test
            registry.Import<ApplyAuthentication>();
            registry.Import<FormsAuthenticationRegistry>();

            theGraphWithBasicAuthentication = BehaviorGraph.BuildFrom(registry);
        }
 protected override void configure(FubuRegistry registry)
 {
     registry.Import<SparkEngine>();
     registry.Actions.IncludeType<UsesPartialController>();
     registry.Actions.IncludeType<HelloPartialController>();
     registry.Views.TryToAttachWithDefaultConventions();
 }
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Import<WindowsAuthFubuRegistryExtension>();

            theGraphWithWindowsAuthentication = BehaviorGraph.BuildFrom(registry);
        }
        public void default_namespaces_are_set_including_anything_from_CommonViewNamespaces()
        {
            var registry = new FubuRegistry();
            registry.Import<RazorViewFacility>();
            registry.AlterSettings<CommonViewNamespaces>(x =>
            {
                x.Add("Foo");
                x.Add("Bar");
            });

            var graph = BehaviorGraph.BuildFrom(registry);
            var useNamespaces = graph.Services.DefaultServiceFor<CommonViewNamespaces>().Value.As<CommonViewNamespaces>();

            useNamespaces.Namespaces.ShouldHaveTheSameElementsAs(new[]
            {
            "System.Web",
            "System",
            "FubuCore",
            "System.Linq",
            "HtmlTags",
            "FubuMVC.Core.UI",
            "FubuMVC.Core.UI.Extensions",
            "FubuMVC.Razor",
            "Foo",
            "Bar"
            });
        }
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Import<YuiCompressionExtensions>();

            theServices = BehaviorGraph.BuildFrom(registry).Services;
        }
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Import<BasicLocalizationSupport>();

            graphWithBasicLocalizationAsIs = BehaviorGraph.BuildFrom(registry);
        }
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Import<ServerSentEventsExtension>();

            theGraph = BehaviorGraph.BuildFrom(registry);
        }
Exemplo n.º 9
0
		public void Configure(FubuRegistry registry)
		{
			registry.Import<HtmlConventionRegistry>(x =>
			{
				x.Forms.Add(new FormModifier());
			});
		}
        private void configurationIs(Action<DateTimePolicies> action)
        {
            container = new Container();
            var registry = new FubuRegistry();
            registry.Services(x =>
            {
                x.SetServiceIfNone<ITimeZoneContext>(theTimeZoneContext);
            });
            registry.Import<FubuMVC.Core.UI.FubuHtmlRegistration>();
            registry.Import<DateTimePolicies>(action);

            FubuApplication.For(registry).StructureMap(container).Bootstrap();


            _formatter = container.GetInstance<IDisplayFormatter>();
        }
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Import<ApplyWindowsAuthentication>();

            theGraph = BehaviorGraph.BuildFrom(registry);
        }
        public void Configure(FubuRegistry registry)
        {
//            registry
//                .Import<SassExtension>();

             registry
                 .Import<VisualizationFubuRegistry>(DiagnosticsRegistration.DIAGNOSTICS_URL_ROOT);
        }
        public void register_a_non_default_culture_info()
        {
            var registry = new FubuRegistry();
            registry.Import<BasicLocalizationSupport>(x => x.DefaultCulture = new CultureInfo("en-CA"));

            BehaviorGraph.BuildFrom(registry).Services.DefaultServiceFor(typeof (CultureInfo))
                .Value.ShouldEqual(new CultureInfo("en-CA"));
        }
 public void Configure(FubuRegistry registry)
 {
     registry.Import<HtmlConventionRegistry>(x =>
     {
         x.FieldChrome<BootstrapFieldChrome>();
         x.Labels.Add(new BootstrapLabelModifier());
     });
 }
        public void uses_the_specified_OAuthSettings()
        {
            var theSettings = new OAuthSettings {ConsumerKey = "blah", ConsumerSecret = "private"};
            var registry = new FubuRegistry();
            registry.Import<ApplyTwitterAuthentication>(x => x.UseOAuthSettings(theSettings));

            var graph = BehaviorGraph.BuildFrom(registry);
            graph.Services.DefaultServiceFor<OAuthSettings>().Value.ShouldEqual(theSettings);
        }
        public void ensure_namespaces_are_imported()
        {
            var registry = new FubuRegistry();
            registry.Import<ContentExtensionsRegistration>();

            var graph = BehaviorGraph.BuildFrom(registry);
            var commonViewNamespaces = graph.Services.DefaultServiceFor<CommonViewNamespaces>().Value.As<CommonViewNamespaces>();
            commonViewNamespaces.Namespaces.ShouldContain(typeof(ContentExtensionGraph).Namespace);
        }
        public void import_with_strings_instead_of_StringToken()
        {
            var registry = new FubuRegistry();
            registry.Import<NavigationRegistryExtension>();

            registry.Policies.Add<NavigationRegistry>(x =>
            {
                x.ForMenu("Key1");
                x.Add += MenuNode.Node("Key2");
                x.Add += MenuNode.Node("Key3");
            });

            registry.Import<ChildRegistry>();

            var graph = BehaviorGraph.BuildFrom(registry).Settings.Get<NavigationGraph>();

            graph.MenuFor("Key1").Select(x => x.Key)
                .ShouldHaveTheSameElementsAs(new NavigationKey("Key2"), new NavigationKey("Key3"));
        }
Exemplo n.º 18
0
        public void the_url_prefix_of_a_fubu_package_registry_should_be_respected()
        {
            var registry = new FubuRegistry();
            registry.Import<FooPackageRegistry>();

            var graph = BehaviorGraph.BuildFrom(registry);

            graph.BehaviorFor<FooEndpointClass>(x => x.get_some_foo())
                 .GetRoutePattern().ShouldEqual("moar/some/foo");
        }
        public void SetUp()
        {
            var registry = new FubuRegistry();
            registry.Import<DiagnosticsRegistration>();

            graph = BehaviorGraph.BuildFrom(registry);
            urls = MockRepository.GenerateMock<IUrlRegistry>();

            graph.Behaviors.Any().ShouldBeTrue();
            graph.Actions().Each(x => Debug.WriteLine(x.Description));
        }
        public void should_only_apply_behavior_once()
        {
            var hostRegistry = new FubuRegistry();
            var packageRegistry = new FubuPackageRegistry();
            packageRegistry.Actions.IncludeType<Controller1>();
            hostRegistry.Import(packageRegistry, string.Empty);
            theGraph = BehaviorGraph.BuildFrom(hostRegistry);

            var chain = chainFor(x => x.BasicContinuation(null))
                .Output.Writers.OfType<Writer>().ShouldHaveCount(1);
        }
        void IFubuRegistryExtension.Configure(FubuRegistry registry)
        {
            registry.Services<BasicLocalizationServices>();
            
            if(_modifications.Any())
            {
                registry.Services(x => _modifications.Each(modify => modify(x)));
            }

            registry.Import<HtmlConventionRegistry>(x => x.Labels.Add(new LabelBuilder()));
        }
        protected override void configure(FubuRegistry registry)
        {
            registry.Actions.IncludeType<ClosestController>();
            registry.Actions.IncludeType<UsesDefaultController>();

            registry.IncludeDiagnostics(true);

            registry.Import<RazorEngineRegistry>();

            registry.Views
                .TryToAttachWithDefaultConventions();
        }
        public void should_only_apply_behavior_once()
        {
            var hostRegistry = new FubuRegistry();
            var packageRegistry = new FubuPackageRegistry();
            packageRegistry.Actions.IncludeType<Controller1>();
            hostRegistry.Import(packageRegistry, string.Empty);
            theGraph = hostRegistry.BuildGraph();

            chainFor(x => x.BasicContinuation(null))
                .Where(x => x is AjaxContinuationNode)
                .ShouldHaveCount(1);
        }
        public FubuApplication BuildApplication()
        {
            var registry = new FubuRegistry();
            registry.Import<DiagnosticApplication>();

            registry.AlterSettings<TransportSettings>(x => {
                x.DelayMessagePolling = Int32.MaxValue;
                x.ListenerCleanupPolling = Int32.MaxValue;
            });

            return FubuApplication.For(registry).StructureMap();
        }
        protected override void configure(FubuRegistry registry)
        {
            registry.Actions.IncludeType<CreateUserEndpoint>();
            registry.Import<FubuMvcValidation>();

            theUserService = new UserService();
            registry.Services(r => r.SetServiceIfNone<IUserService>(theUserService));

            var rule = RemoteFieldRule.For(ReflectionHelper.GetAccessor<CreateUser>(x => x.Username), new UniqueUsernameRule());
            theField = new ValidateField { Hash = rule.ToHash(), Value = "joel_arnold" };
            theUserService.AddUser(theField.Value);
        }
        public void import_navigation_from_child_registry()
        {
            var registry = new FubuRegistry();
            registry.Import<NavigationRegistryExtension>();

            registry.Policies.Add<NavigationRegistry>(x =>
            {
                x.ForMenu(FakeKeys.Key1);
                x.Add += MenuNode.Node(FakeKeys.Key2);
                x.Add += MenuNode.Node(FakeKeys.Key3);
            });

            registry.Import<ChildRegistry>();

            var graph = BehaviorGraph.BuildFrom(registry).Settings.Get<NavigationGraph>();

            graph.MenuFor(FakeKeys.Key1).Select(x => x.Key)
                .ShouldHaveTheSameElementsAs(FakeKeys.Key2, FakeKeys.Key3, FakeKeys.Key4, FakeKeys.Key5);

            graph.MenuFor(FakeKeys.Key6).Select(x => x.Key)
                .ShouldHaveTheSameElementsAs(FakeKeys.Key7, FakeKeys.Key8);
        }
        public void end_to_end()
        {
            var registry = new FubuRegistry();
            registry.Import<ServerSentEventsExtension>();
            registry.Services(x => x.FillType<IRequestCompletion, RequestCompletion>());

            var container = new Container();
            FubuApplication.For(registry).StructureMap(container).Bootstrap();
            var graph = container.GetInstance<BehaviorGraph>();
            var chain = graph.BehaviorFor<ChannelWriter<FakeTopic>>(x => x.Write(null));

            

            container.GetInstance<IActionBehavior>(chain.UniqueId.ToString());
        }
        public void capture_the_configuration_source_from_imports()
        {
            var registry = new FubuRegistry();
            registry.Actions.IncludeClassesSuffixedWithController();
            registry.Import<FakeRegistry>();

            var graph = BehaviorGraph.BuildFrom(registry);

            var chain = graph.BehaviorFor<FakeThing>(x => x.SayHello()).As<ITracedModel>();

            // This is simple
            chain.AllEvents().OfType<Created>().Single().Source.Provenance.ShouldBeOfType<FakeRegistry>();
            chain.AllEvents().OfType<ChainImported>().Single().Source.Action.ShouldBeOfType<RegistryImport>();

            graph.Log.AllConfigSources().Where(x => x.Provenance is FakeRegistry).Any().ShouldBeTrue();
        }
        public void override_the_storage_mechanism()
        {
            var registry = new FubuRegistry();
            registry.Import<BasicLocalizationSupport>(x =>
            {
                x.LocalizationStorageIs<InMemoryLocalizationStorage>();
            });
            var graph = BehaviorGraph.BuildFrom(registry);

            var list = graph.Services.ServicesFor<IActivator>().Select(x => x.Type).ToList();

            list.ShouldNotContain(typeof(RegisterXmlDirectoryLocalizationStorage));
            list.ShouldContain(typeof(SpinUpLocalizationCaches));

            graph.Services.DefaultServiceFor<ILocalizationStorage>().Type.ShouldEqual(
                typeof (InMemoryLocalizationStorage));
        }
        public void has_all_the_chains_we_expect_through_FubuApplication()
        {
            var container = new Container();
            var registry = new FubuRegistry();
            registry.Import<MyFirstTransport>();

            using (var runtime = FubuApplication.For(registry).StructureMap(container).Bootstrap())
            {

                var graph = container.GetInstance<BehaviorGraph>();

                graph.Behaviors.Count(x => typeof(Foo1) == x.InputType()).ShouldEqual(1);
                graph.Behaviors.Count(x => typeof(Foo2) == x.InputType()).ShouldEqual(1);
                graph.Behaviors.Count(x => typeof(Foo3) == x.InputType()).ShouldEqual(1);
                graph.Behaviors.Count(x => typeof(Foo4) == x.InputType()).ShouldEqual(1);
            }
        }
Exemplo n.º 31
0
 public void Apply(FubuRegistry registry)
 {
     registry.Import <T>();
 }
Exemplo n.º 32
0
 public void Apply(FubuRegistry registry, IPackageLog packageLog)
 {
     packageLog.Trace("Applying extension " + typeof(T).FullName);
     registry.Import <T>();
 }
Exemplo n.º 33
0
 public void Apply(FubuRegistry registry)
 {
     _log.Trace("Applying extension " + typeof(T).FullName);
     registry.Import <T>();
 }