public void AddLayer_WhenPassedIndividualParts_CreatesNewLayer()
        {
            var nimator = new NimatorEngine();

            var result1 = new CheckResult("check A", NotificationLevel.Warning);
            var check1  = new Mock <ICheck>();

            check1.Setup(c => c.RunAsync()).Returns(result1.AsTaskResult());

            nimator.AddLayer("dummy name", new [] { check1.Object });

            var result = nimator.RunSafe();

            Assert.That(result.Level, Is.EqualTo(NotificationLevel.Warning));
        }
Example #2
0
        public void RunChecks_WhenLayerHasChecks_RunsThroughAllChecks()
        {
            var result1 = new CheckResult("check A", NotificationLevel.Okay);
            var check1  = new Mock <ICheck>();

            check1.Setup(c => c.RunAsync()).Returns(result1.AsTaskResult());

            var result2 = new CheckResult("check B", NotificationLevel.Okay);
            var check2  = new Mock <ICheck>();

            check2.Setup(c => c.RunAsync()).Returns(result2.AsTaskResult());

            var layer = new Layer("Layer 1", new [] { check1.Object, check2.Object });

            var result = layer.Run();

            check1.Verify(c => c.RunAsync());
            check2.Verify(c => c.RunAsync());
        }
Example #3
0
        public void RunChecks_WhenLayerHasChecks_AccumulatesResults()
        {
            var result1 = new CheckResult("check A", NotificationLevel.Okay);
            var check1  = new Mock <ICheck>();

            check1.Setup(c => c.RunAsync()).Returns(result1.AsTaskResult());

            var result2 = new CheckResult("check B", NotificationLevel.Okay);
            var check2  = new Mock <ICheck>();

            check2.Setup(c => c.RunAsync()).Returns(result2.AsTaskResult());

            var layer = new Layer("Layer 1", new [] { check1.Object, check2.Object });

            var result = layer.Run();

            Assert.That(result.CheckResults.First(), Is.EqualTo(result1));
            Assert.That(result.CheckResults.Last(), Is.EqualTo(result2));
            Assert.That(result.CheckResults.Count(), Is.EqualTo(2));
            Assert.That(result.LayerName, Is.EqualTo("Layer 1"));
        }