Exemplo n.º 1
0
        public void NoReporters_UsesDefaultReporter()
        {
            var xunit = new Testable_xunit();

            var reporter = xunit.GetReporter();

            Assert.IsType <DefaultRunnerReporter>(reporter);
        }
Exemplo n.º 2
0
        public void NoExplicitReporter_NoEnvironmentallyEnabledReporters_UsesDefaultReporter()
        {
            var implicitReporter = Mocks.RunnerReporter(isEnvironmentallyEnabled: false);
            var xunit            = new Testable_xunit();

            xunit.AvailableReporters.Add(implicitReporter);

            var reporter = xunit.GetReporter();

            Assert.IsType <DefaultRunnerReporter>(reporter);
        }
Exemplo n.º 3
0
        public void BadChosenReporter_NoAvailableReporters()
        {
            var xunit = new Testable_xunit {
                Reporter = "foo"
            };

            var reporter = xunit.GetReporter();

            Assert.Null(reporter);
            var eventArgs = Assert.IsType <BuildErrorEventArgs>(xunit.BuildEngine.Captured(x => x.LogErrorEvent(null)).Args().Single());

            Assert.Equal("Reporter value 'foo' is invalid. There are no available reporters.", eventArgs.Message);
        }
Exemplo n.º 4
0
        public void NoExplicitReporter_SelectsFirstEnvironmentallyEnabledReporter()
        {
            var explicitReporter  = Mocks.RunnerReporter("switch");
            var implicitReporter1 = Mocks.RunnerReporter(isEnvironmentallyEnabled: true);
            var implicitReporter2 = Mocks.RunnerReporter(isEnvironmentallyEnabled: true);
            var xunit             = new Testable_xunit();

            xunit.AvailableReporters.AddRange(new[] { explicitReporter, implicitReporter1, implicitReporter2 });

            var reporter = xunit.GetReporter();

            Assert.Same(implicitReporter1, reporter);
        }
Exemplo n.º 5
0
        public void WithEnvironmentalOverride_WithEnvironmentalOverridesDisabled_UsesDefaultReporter()
        {
            var implicitReporter = Mocks.RunnerReporter(isEnvironmentallyEnabled: true);
            var xunit            = new Testable_xunit {
                NoAutoReporters = true
            };

            xunit.AvailableReporters.Add(implicitReporter);

            var reporter = xunit.GetReporter();

            Assert.IsType <DefaultRunnerReporter>(reporter);
        }
Exemplo n.º 6
0
        public void ExplicitReporter_NoEnvironmentalOverride_UsesExplicitReporter()
        {
            var explicitReporter = Mocks.RunnerReporter("switch");
            var xunit            = new Testable_xunit {
                Reporter = "switch"
            };

            xunit.AvailableReporters.Add(explicitReporter);

            var reporter = xunit.GetReporter();

            Assert.Same(explicitReporter, reporter);
        }
Exemplo n.º 7
0
        public void ExplicitReporter_WithEnvironmentalOverride_UsesEnvironmentalOverride()
        {
            var explicitReporter = Mocks.RunnerReporter("switch");
            var implicitReporter = Mocks.RunnerReporter(isEnvironmentallyEnabled: true);
            var xunit            = new Testable_xunit {
                Reporter = "switch"
            };

            xunit.AvailableReporters.AddRange(new[] { explicitReporter, implicitReporter });

            var reporter = xunit.GetReporter();

            Assert.Same(implicitReporter, reporter);
        }
Exemplo n.º 8
0
        public void BadChosenReporter_WithAvailableReporters()
        {
            var xunit = new Testable_xunit {
                Reporter = "foo"
            };

            xunit.AvailableReporters.AddRange(new[] { Mocks.RunnerReporter("switch1"), Mocks.RunnerReporter("switch2") });

            var reporter = xunit.GetReporter();

            Assert.Null(reporter);
            var eventArgs = Assert.IsType <BuildErrorEventArgs>(xunit.BuildEngine.Captured(x => x.LogErrorEvent(null)).Args().Single());

            Assert.Equal("Reporter value 'foo' is invalid. Available reporters: switch1, switch2", eventArgs.Message);
        }
Exemplo n.º 9
0
        public void BadChosenReporter_WithAvailableReporters()
        {
            var xunit = new Testable_xunit { Reporter = "foo" };
            xunit.AvailableReporters.AddRange(new[] { Mocks.RunnerReporter("switch1"), Mocks.RunnerReporter("switch2") });

            var reporter = xunit.GetReporter();

            Assert.Null(reporter);
            var eventArgs = Assert.IsType<BuildErrorEventArgs>(xunit.BuildEngine.Captured(x => x.LogErrorEvent(null)).Args().Single());
            Assert.Equal("Reporter value 'foo' is invalid. Available reporters: switch1, switch2", eventArgs.Message);
        }
Exemplo n.º 10
0
        public void NoExplicitReporter_SelectsFirstEnvironmentallyEnabledReporter()
        {
            var explicitReporter = Mocks.RunnerReporter("switch");
            var implicitReporter1 = Mocks.RunnerReporter(isEnvironmentallyEnabled: true);
            var implicitReporter2 = Mocks.RunnerReporter(isEnvironmentallyEnabled: true);
            var xunit = new Testable_xunit();
            xunit.AvailableReporters.AddRange(new[] { explicitReporter, implicitReporter1, implicitReporter2 });

            var reporter = xunit.GetReporter();

            Assert.Same(implicitReporter1, reporter);
        }
Exemplo n.º 11
0
        public void BadChosenReporter_NoAvailableReporters()
        {
            var xunit = new Testable_xunit { Reporter = "foo" };

            var reporter = xunit.GetReporter();

            Assert.Null(reporter);
            var eventArgs = Assert.IsType<BuildErrorEventArgs>(xunit.BuildEngine.Captured(x => x.LogErrorEvent(null)).Args().Single());
            Assert.Equal("Reporter value 'foo' is invalid. There are no available reporters.", eventArgs.Message);
        }
Exemplo n.º 12
0
        public void WithEnvironmentalOverride_WithEnvironmentalOverridesDisabled_UsesDefaultReporter()
        {
            var implicitReporter = Mocks.RunnerReporter(isEnvironmentallyEnabled: true);
            var xunit = new Testable_xunit { NoAutoReporters = true };
            xunit.AvailableReporters.Add(implicitReporter);

            var reporter = xunit.GetReporter();

            Assert.IsType<DefaultRunnerReporterWithTypes>(reporter);
        }
Exemplo n.º 13
0
        public void ExplicitReporter_WithEnvironmentalOverride_UsesEnvironmentalOverride()
        {
            var explicitReporter = Mocks.RunnerReporter("switch");
            var implicitReporter = Mocks.RunnerReporter(isEnvironmentallyEnabled: true);
            var xunit = new Testable_xunit { Reporter = "switch" };
            xunit.AvailableReporters.AddRange(new[] { explicitReporter, implicitReporter });

            var reporter = xunit.GetReporter();

            Assert.Same(implicitReporter, reporter);
        }
Exemplo n.º 14
0
        public void ExplicitReporter_NoEnvironmentalOverride_UsesExplicitReporter()
        {
            var explicitReporter = Mocks.RunnerReporter("switch");
            var xunit = new Testable_xunit { Reporter = "switch" };
            xunit.AvailableReporters.Add(explicitReporter);

            var reporter = xunit.GetReporter();

            Assert.Same(explicitReporter, reporter);
        }
Exemplo n.º 15
0
        public void NoExplicitReporter_NoEnvironmentallyEnabledReporters_UsesDefaultReporter()
        {
            var implicitReporter = Mocks.RunnerReporter(isEnvironmentallyEnabled: false);
            var xunit = new Testable_xunit();
            xunit.AvailableReporters.Add(implicitReporter);

            var reporter = xunit.GetReporter();

            Assert.IsType<DefaultRunnerReporterWithTypes>(reporter);
        }
Exemplo n.º 16
0
        public void NoReporters_UsesDefaultReporter()
        {
            var xunit = new Testable_xunit();

            var reporter = xunit.GetReporter();

            Assert.IsType<DefaultRunnerReporterWithTypes>(reporter);
        }