public void duplication_collection_validator_returns_error_on_duplicate() { DuplicateCollectionValueValidator <Person> validator; ICollection <Person> m_people = new Collection <Person>(); m_people.Add(new Person(Xpo.UnitOfWork(), "Justin")); m_people.Add(new Person(Xpo.UnitOfWork(), "Wil")); m_people.Add(new Person(Xpo.UnitOfWork(), "Justin")); m_people.Add(new Person(Xpo.UnitOfWork(), "Mark")); validator = new DuplicateCollectionValueValidator <Person>(m_people, "FirstName"); validator.Validated(); Assert.IsTrue(validator.HasError()); }
private bool HasDuplicateMasterComponents() { DuplicateCollectionValueValidator <BomMasterComponent> componentValidator; componentValidator = new DuplicateCollectionValueValidator <BomMasterComponent>( null, Model.BomMasterComponents, "PartNumber"); if (!componentValidator.Validated()) { m_error = componentValidator.Error; return(true); } return(false); }
private bool HasDuplicateComponentCategories() { DuplicateCollectionValueValidator <BomComponentCategory> categoryValidator; categoryValidator = new DuplicateCollectionValueValidator <BomComponentCategory>( null, Model.BomComponentCategories, "Category"); if (!categoryValidator.Validated()) { m_error = categoryValidator.Error; return(true); } return(false); }