public void TestInitialize() { serviceProvider = new MockMappingServiceProvider(); #region Data Contract dcStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(DataContractDslDomainModel)); dcDomainModel = dcStore.GetDomainModel <DataContractDslDomainModel>(); dcTransaction = dcStore.TransactionManager.BeginTransaction(); dcModel = (DataContractModel)dcDomainModel.CreateElement(new Partition(dcStore), typeof(DataContractModel), null); // Specify the Implementation Technology and PMT dcModel.ImplementationTechnology = new DataContractWcfExtensionProvider(); dcModel.ProjectMappingTable = projectMappingTableName; dc = dcStore.ElementFactory.CreateElement(DataContract.DomainClassId) as DataContract; primitiveDataElement = dcStore.ElementFactory.CreateElement(PrimitiveDataType.DomainClassId) as PrimitiveDataType; primitiveDataElement.Name = primitiveDataElementName; #endregion #region Service Contract scStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel)); scDomainModel = scStore.GetDomainModel <ServiceContractDslDomainModel>(); scTransaction = scStore.TransactionManager.BeginTransaction(); scModel = (ServiceContractModel)scDomainModel.CreateElement(new Partition(scStore), typeof(ServiceContractModel), null); scModel.ImplementationTechnology = new ServiceContractWCFExtensionProvider(); scModel.ProjectMappingTable = projectMappingTableName; sc = scStore.ElementFactory.CreateElement(ServiceContract.DomainClassId) as ServiceContract; #endregion #region Validator // Initialize validator's config attributes = new NameValueCollection(); attributes.Add("elementNameProperty", "Name"); #endregion #region Simulate Model //Create the moniker //mel://[DSLNAMESPACE]\[MODELELEMENTTYPE]\[MODELELEMENT.GUID]@[PROJECT]\[MODELFILE] string requestMoniker = string.Format(@"mel://{0}\{1}\{2}@{3}\{4}", primitiveDataElement.GetType().Namespace, primitiveDataElement.GetType().Name, primitiveDataElement.Id.ToString(), dataContractModelProjectName, dataContractModelFileName); // Add a DC to the model dc.DataMembers.Add(primitiveDataElement); dcModel.Contracts.Add(dc); // Create a Fault that references the Data Contract fault = scStore.ElementFactory.CreateElement(DataContractFault.DomainClassId) as DataContractFault; fault.Name = faultName; fault.Type = new MockModelBusReference(primitiveDataElement); // Create an Operation operation = scStore.ElementFactory.CreateElement(Operation.DomainClassId) as Operation; operation.Name = operationContractName; operation.Faults.Add(fault); sc.Operations.Add(operation); #endregion }
public void TestInitialize() { serviceProvider = new MockMappingServiceProvider(); attributes = new NameValueCollection(); attributes.Add("elementNameProperty", "Name"); #region Data Contract dcStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(DataContractDslDomainModel)); dcDomainModel = dcStore.GetDomainModel <DataContractDslDomainModel>(); dcTransaction = dcStore.TransactionManager.BeginTransaction(); dcModel = (DataContractModel)dcDomainModel.CreateElement(new Partition(dcStore), typeof(DataContractModel), null); dcModel.ProjectMappingTable = projectMappingTableName; dc = dcStore.ElementFactory.CreateElement(DataContract.DomainClassId) as DataContract; primitiveDataElement = dcStore.ElementFactory.CreateElement(PrimitiveDataType.DomainClassId) as PrimitiveDataType; primitiveDataElement.Name = primitiveDataElementName; dc.DataMembers.Add(primitiveDataElement); dcModel.Contracts.Add(dc); #endregion #region Service Contract scStore = new Store(serviceProvider, typeof(CoreDesignSurfaceDomainModel), typeof(ServiceContractDslDomainModel)); scDomainModel = scStore.GetDomainModel <ServiceContractDslDomainModel>(); scTransaction = scStore.TransactionManager.BeginTransaction(); scModel = (ServiceContractModel)scDomainModel.CreateElement(new Partition(scStore), typeof(ServiceContractModel), null); scModel.ProjectMappingTable = projectMappingTableName; msg = scStore.ElementFactory.CreateElement(Message.DomainClassId) as Message; msg.Name = messageName; //Create the moniker //mel://[DSLNAMESPACE]\[MODELELEMENTTYPE]\[MODELELEMENT.GUID]@[PROJECT]\[MODELFILE] string requestMoniker = string.Format(@"mel://{0}\{1}\{2}@{3}\{4}", primitiveDataElement.GetType().Namespace, primitiveDataElement.GetType().Name, primitiveDataElement.Id.ToString(), dataContractModelProjectName, dataContractModelFileName); part = scStore.ElementFactory.CreateElement(DataContractMessagePart.DomainClassId) as DataContractMessagePart; part.Name = partName; part.Type = new MockModelBusReference(primitiveDataElement); msg.MessageParts.Add(part); scModel.Messages.Add(msg); #endregion }