本文整理汇总了C#中FubuMVC.Core.FubuRegistry.AlterSettings方法的典型用法代码示例。如果您正苦于以下问题:C# FubuRegistry.AlterSettings方法的具体用法?C# FubuRegistry.AlterSettings怎么用?C# FubuRegistry.AlterSettings使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FubuMVC.Core.FubuRegistry
的用法示例。
在下文中一共展示了FubuRegistry.AlterSettings方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Configure
public void Configure(FubuRegistry registry)
{
MimeType.New("text/jsx", ".jsx");
registry.Services<DiagnosticServiceRegistry>();
registry.AlterSettings<AssetSettings>(x => x.AllowableExtensions.Add(".jsx"));
registry.AlterSettings<DiagnosticsSettings>(x =>
{
x.TraceLevel = TraceLevel.Verbose;
});
registry.Configure(graph => {
var settings = graph.Settings.Get<DiagnosticsSettings>();
if (settings.TraceLevel == TraceLevel.Verbose)
{
graph.Services.Clear(typeof (IBindingLogger));
graph.Services.AddService<IBindingLogger, RecordingBindingLogger>();
graph.Services.Clear(typeof (IBindingHistory));
graph.Services.AddService<IBindingHistory, BindingHistory>();
graph.Services.AddService<ILogListener, RequestTraceListener>();
}
if (settings.TraceLevel == TraceLevel.Production)
{
graph.Services.AddService<ILogListener, ProductionModeTraceListener>();
}
});
}
示例2: should_start_when_transport_disabled
public void should_start_when_transport_disabled()
{
var registry = new FubuRegistry();
registry.AlterSettings<TransportSettings>(x =>
{
x.Enabled = true;
x.InMemoryTransport = InMemoryTransportMode.Enabled;
});
registry.AlterSettings<LightningQueueSettings>(x => x.DisableIfNoChannels = true);
using (var application = registry.ToRuntime())
{
}
}
示例3: is_registered
public void is_registered()
{
var registry = new FubuRegistry();
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.Each(x => Debug.WriteLine(x));
useNamespaces.Namespaces.ShouldHaveTheSameElementsAs(new[]
{
typeof(VirtualPathUtility).Namespace,
typeof(string).Namespace,
typeof(FileSet).Namespace,
typeof(ParallelQuery).Namespace,
typeof(HtmlTag).Namespace,
"Foo",
"Bar",
"FubuMVC.Tests.Docs.Introduction.Overview",
"FubuMVC.Tests.Http.Hosting",
"FubuMVC.Tests.Registration",
"FubuMVC.Core.Continuations",
"FubuMVC.Tests.Registration.Conventions",
"FubuMVC.Core.Resources.PathBased",
"FubuMVC.Tests.Registration.Policies",
"FubuMVC.Tests.Urls",
});
}
示例4: register_with_basic_authentication_disabled
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>();
}
示例5: see_tracing_logs_in_verbose_mode_happy_path
public void see_tracing_logs_in_verbose_mode_happy_path()
{
var registry = new FubuRegistry();
registry.ServiceBus.Enable(true);
registry.Features.Diagnostics.Enable(TraceLevel.Verbose);
registry.ServiceBus.EnableInMemoryTransport();
registry.AlterSettings<LightningQueueSettings>(x => x.DisableIfNoChannels = true);
using (var runtime = registry.ToRuntime())
{
var bus = runtime.Get<IServiceBus>();
bus.Consume(new TracedInput());
var history = runtime.Get<IChainExecutionHistory>();
var log = history.RecentReports().Single(x => x.RootChain != null && x.RootChain.InputType() == typeof(TracedInput));
log.Request["headers"].ShouldBeOfType<Dictionary<string, string>>();
log.Steps.Any().ShouldBeTrue();
log.Steps.Any(x => x.Log is StringMessage).ShouldBeTrue();
log.Steps.Each(x => Debug.WriteLine(x));
}
}
示例6: is_registered
public void is_registered()
{
var registry = new FubuRegistry();
registry.AlterSettings<CommonViewNamespaces>(x =>
{
x.Add("Foo");
x.Add("Bar");
});
using (var runtime = registry.ToRuntime())
{
var container = runtime.Get<IContainer>();
var useNamespaces = container.GetInstance<CommonViewNamespaces>();
useNamespaces.Namespaces.ShouldContain(typeof (VirtualPathUtility).Namespace);
useNamespaces.Namespaces.ShouldContain(typeof (string).Namespace);
useNamespaces.Namespaces.ShouldContain(typeof (FileSet).Namespace);
useNamespaces.Namespaces.ShouldContain(typeof (ParallelQuery).Namespace);
useNamespaces.Namespaces.ShouldContain(typeof (HtmlTag).Namespace);
useNamespaces.Namespaces.ShouldContain("FubuMVC.Tests.Http.Hosting");
useNamespaces.Namespaces.ShouldContain("Foo");
useNamespaces.Namespaces.ShouldContain("Bar");
}
}
示例7: configure
protected virtual void configure(FubuRegistry registry)
{
registry.Actions.IncludeType<SampleController>();
registry.AlterSettings<AuthenticationSettings>(
_ => _.Strategies.AddToEnd(MembershipNode.For<InMemoryMembershipRepository>()));
}
示例8: register_with_basic_authentication_disabled
public void register_with_basic_authentication_disabled()
{
var registry = new FubuRegistry();
registry.AlterSettings<AuthenticationSettings>(_ =>
{
_.Enabled = true;
_.Saml2.Enabled = true;
});
var samlCertificateRepository = MockRepository.GenerateMock<ISamlCertificateRepository>();
samlCertificateRepository.Stub(x => x.AllKnownCertificates()).Return(new SamlCertificate[0]);
registry.Services.SetServiceIfNone<ISamlCertificateRepository>(samlCertificateRepository);
registry.Services.SetServiceIfNone<IPrincipalBuilder>(MockRepository.GenerateMock<IPrincipalBuilder>());
registry.Services.AddService<ISamlResponseHandler>(MockRepository.GenerateMock<ISamlResponseHandler>());
registry.AlterSettings<AuthenticationSettings>(x => {
x.MembershipEnabled = MembershipStatus.Disabled;
});
using (var runtime = registry.ToRuntime())
{
var container = runtime.Get<IContainer>();
var strategies = container.GetAllInstances<IAuthenticationStrategy>();
strategies.Single().ShouldBeOfType<SamlAuthenticationStrategy>();
}
}
示例9: Start
public void Start()
{
_controller = _input.BuildRemoteController();
var context = new StorytellerContext(_controller, _input);
if (_controller.BinPath.IsEmpty())
{
throw new Exception("Could not determine any BinPath for the testing AppDomain. Has the Storyteller specification project been compiled, \nor is Storyteller using the wrong compilation target maybe?\n\ntype 'st.exe ? open' or st.exe ? run' to see the command usages\n\n");
}
context.Start();
var registry = new FubuRegistry();
registry.AlterSettings<DiagnosticsSettings>(_ => _.TraceLevel = TraceLevel.Verbose);
registry.Mode = "development";
registry.HostWith<NOWIN>();
registry.Services.For<IRemoteController>().Use(_controller);
registry.Services.For<StorytellerContext>().Use(context);
registry.Services.IncludeRegistry<WebApplicationRegistry>();
_server = registry.ToRuntime();
}
示例10: can_inject_the_right_html_on_GET_for_html_text
public void can_inject_the_right_html_on_GET_for_html_text()
{
var registry = new FubuRegistry();
registry.AlterSettings<OwinSettings>(x =>
{
x.AddMiddleware<HtmlHeadInjectionMiddleware>().Arguments.With(new InjectionOptions
{
Content = e => new HtmlTag("script").Attr("foo", "bar").ToString()
});
});
using (var server = registry.ToRuntime())
{
server.Scenario(_ =>
{
_.Get.Action<SimpleHtmlEndpoint>(x => x.get_html_content());
_.ContentShouldContain("<script foo=\"bar\"></script></head>");
});
server.Scenario(_ =>
{
_.Get.Action<SimpleHtmlEndpoint>(x => x.get_text_content());
_.ContentShouldNotContain("<script foo=\"bar\"></script></head>");
});
}
}
示例11: default_namespaces_are_set_including_anything_from_CommonViewNamespaces
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"
});
}
示例12: do_nothing_if_tracing_is_off
public void do_nothing_if_tracing_is_off()
{
var registry = new FubuRegistry();
registry.AlterSettings<DiagnosticsSettings>(x => x.TraceLevel = TraceLevel.None);
registry.Configure(graph =>
{
chain1 = new BehaviorChain();
chain1.AddToEnd(Wrapper.For<SimpleBehavior>());
chain1.AddToEnd(Wrapper.For<DifferentBehavior>());
chain1.Route = new RouteDefinition("something");
graph.AddChain(chain1);
chain2 = new BehaviorChain();
chain2.IsPartialOnly = true;
chain2.AddToEnd(Wrapper.For<SimpleBehavior>());
chain2.AddToEnd(Wrapper.For<DifferentBehavior>());
graph.AddChain(chain2);
});
registry.Policies.Add<ApplyTracing>();
var notTracedGraph = BehaviorGraph.BuildFrom(registry);
notTracedGraph.Behaviors.SelectMany(x => x).Any(x => x is DiagnosticBehavior).ShouldBeFalse();
notTracedGraph.Behaviors.SelectMany(x => x).Any(x => x is BehaviorTracer).ShouldBeFalse();
}
示例13: configure
protected override void configure(FubuRegistry registry)
{
registry.Actions.IncludeType<ProfileController>();
// I want the default to work here.
//registry.Views.TryToAttachWithDefaultConventions();
registry.AlterSettings<ViewAttachmentPolicy>(x => x.Profile<Mobile>("m."));
}
示例14: BuildApplication
public FubuApplication BuildApplication()
{
//throw new NotImplementedException("You suck!");
var registry = new FubuRegistry();
registry.AlterSettings<ConfigurationSettings>(x => {
x.Include<ColorSettings>();
});
return FubuApplication.For(registry).StructureMap(new Container());
}
示例15: RazorViewFacility
void IFubuRegistryExtension.Configure(FubuRegistry registry)
{
registry.ViewFacility(new RazorViewFacility(_templateRegistry, _parsings));
registry.Services(configureServices);
registry.AlterSettings<CommonViewNamespaces>(x =>
{
x.AddForType<RazorViewFacility>(); // FubuMVC.Razor
x.AddForType<IPartialInvoker>(); // FubuMVC.Core.UI
});
}