public void ValidateDetectsDuplicateChildItems() { var errorAdded = false; var project1 = new Project("Project"); var project2 = new Project("Project"); var project3 = new Project("OtherProject"); var queue = new Queue("QueueName", project1, project2, project3); var validationStub = new ValidationLogStub { OnAddErrorMessage = (m, a) => { Assert.AreEqual( "Duplicate {1} name detected: '{0}'", m); CollectionAssert.AreEqual( new[] { "Project", "child" }, a); errorAdded = true; } }; queue.Validate(validationStub); Assert.IsTrue(errorAdded); }
public void ValidateValidatesChildren() { var validated = false; var projectStub = new ProjectStub { OnValidate = vl => validated = true }; var validationMock = new Mock<IValidationLog>(); var queue = new Queue("Test", projectStub); queue.Validate(validationMock.Object); Assert.IsTrue(validated); }