Example #1
0
        public void RenderPlainText_WhenChecksHaveErrors_IncludesMessages()
        {
            var checkresults = new[]
            {
                new CheckResult("check-a", NotificationLevel.Error, "custom message abc"),
                new CheckResult("check-b", NotificationLevel.Critical, "custom message xyz"),
            };

            var sut = new LayerResult("layer A", checkresults);

            var result = sut.RenderPlainText(NotificationLevel.Error);

            Assert.That(result.ToLowerInvariant(), Does.Contain("abc"));
            Assert.That(result.ToLowerInvariant(), Does.Contain("xyz"));
        }
Example #2
0
        public void RenderPlainText_WhenResultIsMeaningFul_CombinesAllParts()
        {
            var checkresults = new[]
            {
                new CheckResult("check i", NotificationLevel.Okay),
                new CheckResult("check ii", NotificationLevel.Error),
            };

            var sut = new LayerResult("layer A", checkresults);

            var result = sut.RenderPlainText(NotificationLevel.Error);

            Assert.That(result, Does.Contain("layer A"));
            Assert.That(result, Does.Contain("Error"));
            Assert.That(result, Does.Contain("2"), "Expected number of child CheckResults to be in ToString value.");
        }
Example #3
0
        public void RenderPlainText_WhenAskingForWarnings_IncludesWarningMessages()
        {
            var checkresults = new[]
            {
                new CheckResult("check-a", NotificationLevel.Okay, "Everything is Okay"),
                new CheckResult("check-a", NotificationLevel.Warning, "Everything is Warning"),
                new CheckResult("check-a", NotificationLevel.Error, "Everything is Error"),
                new CheckResult("check-b", NotificationLevel.Critical, "Everything is Critical"),
            };

            var sut = new LayerResult("layer A", checkresults);

            var result = sut.RenderPlainText(NotificationLevel.Warning);

            Assert.That(result, Does.Contain("Everything is Warning"));
            Assert.That(result, Does.Contain("Everything is Error"));
            Assert.That(result, Does.Contain("Everything is Critical"));
        }
Example #4
0
        public void RenderPlainText_WhenChecksHaveErrors_IncludesCheckNames()
        {
            var checkresults = new[]
            {
                new CheckResult("check a", NotificationLevel.Okay),
                new CheckResult("check b", NotificationLevel.Warning),
                new CheckResult("check c", NotificationLevel.Error),
                new CheckResult("check d", NotificationLevel.Error),
                new CheckResult("check e", NotificationLevel.Critical),
            };

            var sut = new LayerResult("layer A", checkresults);

            var result = sut.RenderPlainText(NotificationLevel.Error);

            Assert.That(result.ToLowerInvariant(), Does.Not.Contain("check a"));
            Assert.That(result.ToLowerInvariant(), Does.Not.Contain("check b"));
            Assert.That(result.ToLowerInvariant(), Does.Contain("check c"));
            Assert.That(result.ToLowerInvariant(), Does.Contain("check d"));
            Assert.That(result.ToLowerInvariant(), Does.Contain("check e"));
        }