private static object AttachDataContractCollectionExtender(DataContractCollectionBase element, Type collectionType) { WCFDataContractCollection extender = new WCFDataContractCollection(); extender.CollectionType = collectionType; extender.ModelElement = element; return(extender); }
public void ReturnSuccessForValidCollection() { Store store = new Store(new MockServiceProvider(), typeof(CoreDesignSurfaceDomainModel), typeof(DataContractDslDomainModel)); using(Transaction t = store.TransactionManager.BeginTransaction()) { DataContractCollection collection = store.ElementFactory.CreateElement(DataContractCollection.DomainClassId) as DataContractCollection; WCFDataContractCollection extensionProvider = new WCFDataContractCollection(); extensionProvider.CollectionType = typeof(List<>); collection.ObjectExtender = extensionProvider; NonEmptyDataContractCollectionBaseCollectionTypeValidator validator = new NonEmptyDataContractCollectionBaseCollectionTypeValidator(null); ValidationResults validationResults = validator.Validate(collection); Assert.IsTrue(validationResults.IsValid); t.Rollback(); } }
public void ReturnSuccessForValidCollection() { Store store = new Store(new MockServiceProvider(), typeof(CoreDesignSurfaceDomainModel), typeof(DataContractDslDomainModel)); using (Transaction t = store.TransactionManager.BeginTransaction()) { DataContractCollection collection = store.ElementFactory.CreateElement(DataContractCollection.DomainClassId) as DataContractCollection; WCFDataContractCollection extensionProvider = new WCFDataContractCollection(); extensionProvider.CollectionType = typeof(List <>); collection.ObjectExtender = extensionProvider; NonEmptyDataContractCollectionBaseCollectionTypeValidator validator = new NonEmptyDataContractCollectionBaseCollectionTypeValidator(null); ValidationResults validationResults = validator.Validate(collection); Assert.IsTrue(validationResults.IsValid); t.Rollback(); } }
private static object AttachDataContractCollectionExtender(DataContractCollectionBase element, Type collectionType) { WCFDataContractCollection extender = new WCFDataContractCollection(); extender.CollectionType = collectionType; extender.ModelElement = element; return extender; }