示例#1
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"));
        }