示例#1
0
        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());
        }
示例#2
0
        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);
        }
示例#3
0
        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);
        }