Inheritance: IActivator, IEnvironmentRequirements
Ejemplo n.º 1
0
        public void should_run_all_of_the_environment_checks_in_bootstrapping()
        {
            var activator = new FakeActivator();

            activator.SucceedWith("good");
            activator.SucceedWith("better");
            activator.SucceedWith("best");

            PackageRegistry.LoadPackages(x => {
                x.Activator(activator);
            });

            activator.Requirements().OfType <FakeEnvironmentReqirement>()
            .Select(x => x.WasCalled)
            .ShouldHaveTheSameElementsAs(true, true, true);
        }
Ejemplo n.º 2
0
        public void activators_do_not_run_if_any_environment_check_fails()
        {
            var activator = new FakeActivator();

            activator.SucceedWith("good");
            activator.SucceedWith("better");
            activator.FailWith("worst");

            var activator2 = new FakeActivator();
            var activator3 = new FakeActivator();

            PackageRegistry.LoadPackages(x =>
            {
                x.Activator(activator);
                x.Activator(activator2);
                x.Activator(activator3);
            });

            activator.WasActivated.ShouldBeFalse();
            activator2.WasActivated.ShouldBeFalse();
            activator3.WasActivated.ShouldBeFalse();
        }
Ejemplo n.º 3
0
        public void environment_checks_are_logged_in_diagnostic_log()
        {
            var activator = new FakeActivator();

            activator.SucceedWith("good");
            activator.SucceedWith("better");
            activator.FailWith("worst");

            var activator2 = new FakeActivator();
            var activator3 = new FakeActivator();

            PackageRegistry.LoadPackages(x =>
            {
                x.Activator(activator);
                x.Activator(activator2);
                x.Activator(activator3);
            });

            PackageRegistry.Diagnostics.LogsForSubjectType <IEnvironmentRequirement>()
            .Select(x => x.Subject)
            .ShouldHaveTheSameElementsAs(activator.Requirements());
        }
Ejemplo n.º 4
0
        public void activators_should_run_if_all_environment_checks_pass()
        {
            var activator = new FakeActivator();

            activator.SucceedWith("good");
            activator.SucceedWith("better");
            activator.SucceedWith("best");

            var activator2 = new FakeActivator();
            var activator3 = new FakeActivator();

            PackageRegistry.LoadPackages(x =>
            {
                x.Activator(activator);
                x.Activator(activator2);
                x.Activator(activator3);
            });

            PackageRegistry.AssertNoFailures();

            activator.WasActivated.ShouldBeTrue();
            activator2.WasActivated.ShouldBeTrue();
            activator3.WasActivated.ShouldBeTrue();
        }
Ejemplo n.º 5
0
        public void activators_do_not_run_if_any_environment_check_fails()
        {
            var activator = new FakeActivator();
            activator.SucceedWith("good");
            activator.SucceedWith("better");
            activator.FailWith("worst");

            var activator2 = new FakeActivator();
            var activator3 = new FakeActivator();

            PackageRegistry.LoadPackages(x =>
            {
                x.Activator(activator);
                x.Activator(activator2);
                x.Activator(activator3);
            });

            activator.WasActivated.ShouldBeFalse();
            activator2.WasActivated.ShouldBeFalse();
            activator3.WasActivated.ShouldBeFalse();
        }
Ejemplo n.º 6
0
        public void should_run_all_of_the_environment_checks_in_bootstrapping()
        {
            var activator = new FakeActivator();
            activator.SucceedWith("good");
            activator.SucceedWith("better");
            activator.SucceedWith("best");

            PackageRegistry.LoadPackages(x => {
                x.Activator(activator);
            });

            activator.Requirements().OfType<FakeEnvironmentReqirement>()
                .Select(x => x.WasCalled)
                .ShouldHaveTheSameElementsAs(true, true, true);
        }
Ejemplo n.º 7
0
        public void environment_checks_are_logged_in_diagnostic_log()
        {
            var activator = new FakeActivator();
            activator.SucceedWith("good");
            activator.SucceedWith("better");
            activator.FailWith("worst");

            var activator2 = new FakeActivator();
            var activator3 = new FakeActivator();

            PackageRegistry.LoadPackages(x =>
            {
                x.Activator(activator);
                x.Activator(activator2);
                x.Activator(activator3);
            });

            PackageRegistry.Diagnostics.LogsForSubjectType<IEnvironmentRequirement>()
                .Select(x => x.Subject)
                .ShouldHaveTheSameElementsAs(activator.Requirements());
        }
Ejemplo n.º 8
0
        public void activators_should_run_if_all_environment_checks_pass()
        {
            var activator = new FakeActivator();
            activator.SucceedWith("good");
            activator.SucceedWith("better");
            activator.SucceedWith("best");

            var activator2 = new FakeActivator();
            var activator3 = new FakeActivator();

            PackageRegistry.LoadPackages(x =>
            {
                x.Activator(activator);
                x.Activator(activator2);
                x.Activator(activator3);
            });

            PackageRegistry.AssertNoFailures();

            activator.WasActivated.ShouldBeTrue();
            activator2.WasActivated.ShouldBeTrue();
            activator3.WasActivated.ShouldBeTrue();
        }