示例#1
0
        private IServiceProvider GetServiceProvider(WaitService waitService)
        {
            var services = new ServiceCollection();

            services.AddInstance(waitService);
            return(TestHelper.CreateServices("RazorWebSite", services));
        }
示例#2
0
 public InlineConstraintTests()
 {
     _provider = TestHelper.CreateServices("InlineConstraintsWebSite");
     _provider = new ServiceCollection()
                 .AddScoped <ICommandLineArgumentBuilder, DefaultCommandLineArgumentBuilder>()
                 .BuildServiceProvider(_provider);
 }
        private IServiceProvider GetServiceProvider(TestPageExecutionContext pageExecutionContext)
        {
            var services = new ServiceCollection();

            services.AddInstance(pageExecutionContext);
            return(TestHelper.CreateServices("RazorInstrumentationWebsite", services));
        }
示例#4
0
        public async Task AutofacDIContainerCanUseMvc(string url, string expectedResponseBody)
        {
            // Arrange
            var provider = TestHelper.CreateServices("AutofacWebSite");
            Action <IApplicationBuilder> app = new Startup().Configure;

            // Act & Assert (does not throw)
            // This essentially calls into the Startup.Configuration method
            var server = TestServer.Create(provider, app);

            // Make a request to start resolving DI pieces
            var response = await server.CreateClient().GetAsync(url);

            var actualResponseBody = await response.Content.ReadAsStringAsync();

            Assert.Equal(expectedResponseBody, actualResponseBody);
        }
示例#5
0
        public async Task AutofacDIContainerCanUseMvc(string url, string expectedResponseBody)
        {
            // Arrange
            var provider               = TestHelper.CreateServices("AutofacWebSite");
            Action <IBuilder> app      = new Startup().Configure;
            TestServer        server   = null;
            HttpResponse      response = null;

            // Act & Assert
            await Assert.DoesNotThrowAsync(async() =>
            {
                // This essentially calls into the Startup.Configuration method
                server = TestServer.Create(provider, app);

                // Make a request to start resolving DI pieces
                response = await server.Handler.GetAsync(url);
            });

            var actualResponseBody = new StreamReader(response.Body).ReadToEnd();

            Assert.Equal(expectedResponseBody, actualResponseBody);
        }
示例#6
0
 public BasicTests()
 {
     _provider = TestHelper.CreateServices("BasicWebSite");
 }
示例#7
0
 public ValueProviderTest()
 {
     _services = TestHelper.CreateServices("ValueProvidersSite");
 }
示例#8
0
 public CompositeViewEngineTests()
 {
     _services = TestHelper.CreateServices("CompositeViewEngine");
 }
示例#9
0
 public RoutingTests()
 {
     _services = TestHelper.CreateServices("RoutingWebSite");
 }
示例#10
0
 public InputFormatterTests()
 {
     _services = TestHelper.CreateServices("FormatterWebSite");
 }