コード例 #1
0
        public void Creates_RocketHost_ForAssemblies()
        {
            var host = new WebJobsBuilder().UseRocketBooster(new Startup(), RocketBooster.For(new[] { typeof(RocketHostTests).Assembly }),
                                                             rb => { });

            host.Should().BeAssignableTo <IWebJobsBuilder>();
        }
コード例 #2
0
        public void Should_Build_The_Host_Correctly()
        {
            var serviceConventionFake       = A.Fake <IServiceConvention>();
            var configurationConventionFake = A.Fake <IConfigurationConvention>();

            var startup = new Startup();
            var builder = new WebJobsBuilder()
                          .UseRocketSurgery(
                startup,
                rb => rb
                .UseScanner(
                    new BasicConventionScanner(
                        A.Fake <IServiceProviderDictionary>(),
                        serviceConventionFake,
                        configurationConventionFake
                        )
                    )
                .UseAssemblyCandidateFinder(
                    new DefaultAssemblyCandidateFinder(new[] { typeof(RocketHostBuilderTests).Assembly })
                    )
                .UseAssemblyProvider(
                    new DefaultAssemblyProvider(new[] { typeof(RocketHostBuilderTests).Assembly })
                    )
                );

            var sp = builder.Services.BuildServiceProvider();

            sp.Should().NotBeNull();
        }
コード例 #3
0
        public void Should_UseRocketBooster()
        {
            var startup = new Startup();
            var builder = new WebJobsBuilder()
                          .UseRocketBooster(startup, RocketBooster.For(AppDomain.CurrentDomain), rb => { });

            var sp = builder.Services.BuildServiceProvider();

            sp.Should().NotBeNull();
        }
コード例 #4
0
        public void Creates_RocketHost_ForAppDomain()
        {
            var host = new WebJobsBuilder().UseRocketBooster(
                new Startup(),
                RocketBooster.For(AppDomain.CurrentDomain),
                rb => { }
                );

            host.Should().BeAssignableTo <IWebJobsBuilder>();
        }
コード例 #5
0
        public void Should_UseAssemblies()
        {
            var startup = new Startup();
            var builder = new WebJobsBuilder()
                          .UseRocketSurgery(startup, rb => rb
                                            .UseAssemblies(AppDomain.CurrentDomain.GetAssemblies())
                                            );

            var sp = builder.Services.BuildServiceProvider();

            sp.Should().NotBeNull();
        }
コード例 #6
0
        public void Should_UseDependencyContext()
        {
            var startup = new Startup();
            var builder = new WebJobsBuilder()
                          .UseRocketSurgery(startup, rb => rb
                                            .UseDependencyContext(DependencyContext.Default)
                                            );

            var sp = builder.Services.BuildServiceProvider();

            sp.Should().NotBeNull();
        }
コード例 #7
0
        public void Should_Call_Through_To_Convention_Methods()
        {
            var convention = AutoFake.Resolve <IConvention>();
            var startup    = new Startup();
            var builder    = new WebJobsBuilder()
                             .UseRocketSurgery(startup, rb => rb
                                               .UseScanner(AutoFake.Resolve <IConventionScanner>())
                                               .PrependConvention(convention)
                                               .AppendConvention(convention)
                                               );

            A.CallTo(() => AutoFake.Resolve <IConventionScanner>().PrependConvention(A <IConvention> ._)).MustHaveHappened(1, Times.Exactly);
            A.CallTo(() => AutoFake.Resolve <IConventionScanner>().AppendConvention(A <IConvention> ._)).MustHaveHappened(1, Times.Exactly);
        }
コード例 #8
0
        public void Should_Call_Through_To_Delegate_Methods()
        {
            var startup = new Startup();
            var builder = new WebJobsBuilder()
                          .UseRocketBooster(
                startup,
                RocketBooster.For(DependencyContext.Load(typeof(RocketHostTests).Assembly)),
                rb => rb
                .UseScanner(AutoFake.Resolve <IConventionScanner>())
                .PrependDelegate(new Action(() => { }))
                .AppendDelegate(new Action(() => { }))
                );

            A.CallTo(() => AutoFake.Resolve <IConventionScanner>().PrependDelegate(A <Delegate> ._)).MustHaveHappened(1, Times.Exactly);
            A.CallTo(() => AutoFake.Resolve <IConventionScanner>().AppendDelegate(A <Delegate> ._)).MustHaveHappened(1, Times.Exactly);
        }