public void DoValidateCollectionItemSucceedsForUniqueNamedElements()
		{
			Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel));
			ServiceContractModel model;

			using (Transaction transaction = store.TransactionManager.BeginTransaction())
			{
				model = store.ElementFactory.CreateElement(ServiceContractModel.DomainClassId) as ServiceContractModel;

				Message contract = store.ElementFactory.CreateElement(Message.DomainClassId) as Message;
				contract.Name = "Contract Name";

				MessagePart part = store.ElementFactory.CreateElement(PrimitiveMessagePart.DomainClassId) as PrimitiveMessagePart;
				part.Name = "Part Name";

				contract.MessageParts.Add(part);

				TestableMessagePartElementCollectionValidator target = new TestableMessagePartElementCollectionValidator();

				ValidationResults results = new ValidationResults();
				target.TestDoValidateCollectionItem(part, contract, String.Empty, results);

				Assert.IsTrue(results.IsValid);

				transaction.Commit();
			}
		}
Exemple #2
0
        public void DoValidateCollectionItemSucceedsForUniqueNamedElements()
        {
            Store store = new Store(typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel));
            ServiceContractModel model;

            using (Transaction transaction = store.TransactionManager.BeginTransaction())
            {
                model = store.ElementFactory.CreateElement(ServiceContractModel.DomainClassId) as ServiceContractModel;

                Message contract = store.ElementFactory.CreateElement(Message.DomainClassId) as Message;
                contract.Name = "Contract Name";

                MessagePart part = store.ElementFactory.CreateElement(PrimitiveMessagePart.DomainClassId) as PrimitiveMessagePart;
                part.Name = "Part Name";

                contract.MessageParts.Add(part);

                TestableMessagePartElementCollectionValidator target = new TestableMessagePartElementCollectionValidator();

                ValidationResults results = new ValidationResults();
                target.TestDoValidateCollectionItem(part, contract, String.Empty, results);

                Assert.IsTrue(results.IsValid);

                transaction.Commit();
            }
        }