本文整理汇总了C#中ConfigurableBootstrapper类的典型用法代码示例。如果您正苦于以下问题:C# ConfigurableBootstrapper类的具体用法?C# ConfigurableBootstrapper怎么用?C# ConfigurableBootstrapper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurableBootstrapper类属于命名空间,在下文中一共展示了ConfigurableBootstrapper类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializerTests
public SerializerTests()
{
this.bootstrapper = new ConfigurableBootstrapper(
configuration => configuration.Modules(new Type[] { typeof(SerializerTestModule) }));
this.browser = new Browser(bootstrapper);
}
示例2: GET_Given_An_Url_Shortened_Should_Return_Data_Of_The_Url
public void GET_Given_An_Url_Shortened_Should_Return_Data_Of_The_Url()
{
//Arrange
var url = new Model.Url("http://www.2dsolucoes.net");
var repository = new StubUrlStorage(url);
var bootstrapper = new ConfigurableBootstrapper(with =>
{
with.Dependency<IUrlStorage>(repository);
});
var browser = new Browser(bootstrapper);
//Act
var urlAPI = string.Format("/urls/{0}", url.Short);
var response = browser.Get(urlAPI, ctx =>
{
ctx.HttpRequest();
});
dynamic result = response.Body.ToDynamic();
//Assert
Assert.That(response.StatusCode, Is.EqualTo(HttpStatusCode.OK));
Assert.That((string)result.Source, Is.EqualTo(url.Source));
Assert.That((string)result.Short, Is.EqualTo(url.Short));
}
示例3: BrowserFixture
public BrowserFixture()
{
var bootstrapper =
new ConfigurableBootstrapper();
this.browser = new Browser(bootstrapper);
}
示例4: Should_return_main_page_with_valid_auth_cookie
public void Should_return_main_page_with_valid_auth_cookie()
{
// Given
var bootstrapper = new ConfigurableBootstrapper(with =>
{
with.Configure(env =>
{
env.Diagnostics(
password: "password",
cryptographyConfiguration: this.cryptoConfig);
});
with.EnableAutoRegistration();
with.Diagnostics<FakeDiagnostics>();
});
var browser = new Browser(bootstrapper);
// When
var result = browser.Get(DiagnosticsConfiguration.Default.Path + "/interactive/providers/", with =>
{
with.Cookie(DiagsCookieName, this.GetSessionCookieValue("password"));
});
// Then should see our fake provider and not the default testing provider
result.Body.AsString().ShouldContain("Fake testing provider");
result.Body.AsString().ShouldNotContain("Testing Diagnostic Provider");
}
示例5: Should_return_info_page_if_password_empty
public async Task Should_return_info_page_if_password_empty()
{
// Given
var bootstrapper = new ConfigurableBootstrapper(with =>
{
with.Configure(env =>
{
env.Diagnostics(
enabled: true,
password: string.Empty,
cryptographyConfiguration: this.cryptoConfig);
});
with.EnableAutoRegistration();
with.Diagnostics<DefaultDiagnostics>();
});
var browser = new Browser(bootstrapper);
// When
var result = await browser.Get(DiagnosticsConfiguration.Default.Path);
// Then
Assert.True(result.Body.AsString().Contains("Diagnostics Disabled"));
}
示例6: Should_fail_to_resolve_route_because_it_does_have_an_invalid_condition
public void Should_fail_to_resolve_route_because_it_does_have_an_invalid_condition()
{
// Given
var cache = new FakeRouteCache(with => {
with.AddGetRoute("/invalidcondition", "modulekey", ctx => false);
});
var bootstrapper = new ConfigurableBootstrapper(with =>{
with.RouteCache(cache);
});
var browser = new Browser(bootstrapper);
// When
var timer = new Stopwatch();
timer.Start();
for (var i = 0; i < numberOfTimesToResolveRoute; i++)
{
var result = browser.Get("/invalidcondition");
result.StatusCode.ShouldEqual(HttpStatusCode.NotFound);
}
timer.Stop();
// Then
Debug.WriteLine(" took {0} to execute {1} times", timer.Elapsed, numberOfTimesToResolveRoute);
}
示例7: SetUp
public void SetUp()
{
_fakeShortener = new FakeShortener();
_bootstrapper = new ConfigurableBootstrapper(with => with.Dependency(_fakeShortener));
_browser = new Browser(_bootstrapper);
}
示例8: SetUpBase
public void SetUpBase()
{
this.ContentRepository = MockRepository.GenerateMock<IContentRepository>();
this.ComponentLibrary = MockRepository.GenerateMock<IComponentSpecificationLibrary>();
this.KolaConfigurationRegistry = MockRepository.GenerateMock<IKolaConfigurationRegistry>();
this.DynamicSourceProvider = MockRepository.GenerateMock<IDynamicSourceProvider>();
var bootstrapper = new ConfigurableBootstrapper(
with =>
{
with.Dependency(this.ContentRepository);
with.Dependency(this.ComponentLibrary);
with.Dependency(this.KolaConfigurationRegistry);
with.Dependency(this.DynamicSourceProvider);
with.Dependency<TemplateResourceBuilder>();
with.Dependency<AmendmentDetailsResourceBuilder>();
with.Dependency<PathInstanceBuilder>();
with.Dependency<AmendmentsDetailsResourceBuilder>();
with.Dependency<UndoAmendmentDetailsResourceBuilder>();
with.Dependency<ComponentDetailsResourceBuilder>();
with.ResponseProcessor<TemplateJsonResultProcessor>();
with.ResponseProcessor<AmendmentDetailsJsonResultProcessor>();
with.ResponseProcessor<AmendmentsDetailsJsonResultProcessor>();
with.ResponseProcessor<UndoAmendmentDetailsJsonResultProcessor>();
with.ResponseProcessor<ComponentDetailsJsonResultProcessor>();
with.Dependency<TemplateService>();
with.Module<TemplateModule>();
});
this.Browser = new Browser(bootstrapper);
}
示例9: FixtureSetup
public void FixtureSetup()
{
var formsAuthenticationConfiguration = new FormsAuthenticationConfiguration()
{
RedirectUrl = "~/login",
UserMapper = new FakeUserMapper(new UserService())
};
var configuration = A.Fake<IRazorConfiguration>();
var bootstrapper = new ConfigurableBootstrapper(config =>
{
config.Module<UsersModule>();
config.Module<LoginModule>();
config.ViewEngine(new RazorViewEngine(configuration));
});
var bootstrapper2 = new ConfigurableBootstrapper(config =>
{
config.Module<UsersModule>();
config.Module<LoginModule>();
config.ViewEngine(new RazorViewEngine(configuration));
config.RequestStartup((x, pipelines, z) => FormsAuthentication.Enable(pipelines, formsAuthenticationConfiguration));
});
_notLoggedInBrowser = new Browser(bootstrapper);
_loggedInBrowserResponse = new Browser(bootstrapper2).Post("/login", x =>
{
x.HttpRequest();
x.FormValue("Username", "Chris1");
x.FormValue("Password", "123");
});
}
示例10: AbsoluteUrlTests
public AbsoluteUrlTests()
{
this.bootstrapper = new ConfigurableBootstrapper(
configuration => configuration.Modules(new Type[] { typeof(AbsoluteUrlTestModule) }));
this.browser = new Browser(bootstrapper);
}
示例11: Should_find_usages_of_class
public void Should_find_usages_of_class()
{
const string editorText =
@"public class myclass
{
public void method() { }
public void method_calling_method()
{
method();
}
}
";
var solution = new FakeSolution();
var project = new FakeProject();
project.AddFile(editorText);
solution.Projects.Add(project);
var bootstrapper = new ConfigurableBootstrapper(c => c.Dependency<ISolution>(solution));
var browser = new Browser(bootstrapper);
var result = browser.Post("/findusages", with =>
{
with.HttpRequest();
with.FormValue("FileName", "myfile");
with.FormValue("Line", "3");
with.FormValue("Column", "21");
with.FormValue("Buffer", editorText);
});
var usages = result.Body.DeserializeJson<FindUsagesResponse>().Usages.ToArray();
usages.Count().ShouldEqual(2);
usages[0].Text.Trim().ShouldEqual("public void method() { }");
usages[1].Text.Trim().ShouldEqual("method();");
}
示例12: When_enabling_sessions
public When_enabling_sessions()
{
_Bootstrapper = new ConfigurableBootstrapper(with =>
{
with.DisableAutoRegistration();
});
KeyValueStoreSessions.Enable(_Bootstrapper, A.Fake<IKeyValueStore>());
}
示例13: Nsub_WithBootstrapper_GetCalled
public void Nsub_WithBootstrapper_GetCalled()
{
this.task.GetValue().Returns("i did not fail");
var bs = new ConfigurableBootstrapper(
with => { with.Dependency(this.task).Module<IndexModule>(); });
var browser = new Browser(bs);
var actual = browser.Get("/");
Assert.That(actual.Body.AsString(), Is.EqualTo("i did not fail"));
}
示例14: PartialRenderingFixture
public PartialRenderingFixture()
{
var bootstrapper = new ConfigurableBootstrapper(with => {
with.Module<PartialRenderingModule>();
});
this.browser =
new Browser(bootstrapper);
}
示例15: CaseSensitivityFixture
public CaseSensitivityFixture()
{
var bootstrapper = new ConfigurableBootstrapper(with =>
{
with.Module<MainModule>();
});
this.browser = new Browser(bootstrapper);
}