コード例 #1
0
 protected static void Establish_context()
 {
     entity = BrokerData.CreateBasicEntity();
     var notAMapping = new EnergyTrading.MDM.Contracts.Sample.Broker();
     content = HttpContentExtensions.CreateDataContract(notAMapping);
     client = new HttpClient();
 }
コード例 #2
0
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = BrokerData.CreateBasicEntity();

            content = HttpContentExtensions.CreateDataContract(new EnergyTrading.MDM.Contracts.Sample.Broker());
            startVersion = CurrentEntityVersion();
        }
コード例 #3
0
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = BrokerData.CreateBasicEntity();

            content      = HttpContentExtensions.CreateDataContract(new EnergyTrading.MDM.Contracts.Sample.Broker());
            startVersion = CurrentEntityVersion();
        }
コード例 #4
0
        protected static void Establish_context()
        {
            entity = BrokerData.CreateBasicEntity();
            var notAMapping = new EnergyTrading.MDM.Contracts.Sample.Broker();

            content = HttpContentExtensions.CreateDataContract(notAMapping);
            client  = new HttpClient();
        }
コード例 #5
0
 protected static void Establish_context()
 {
     entity = BrokerData.CreateBasicEntityWithOneMapping();
     client = new HttpClient();
     var notAMapping = new MDM.Broker();
     content = HttpContentExtensions.CreateDataContract(notAMapping);
     startVersion = CurrentEntityVersion();
 }
コード例 #6
0
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = BrokerData.CreateBasicEntity();
            var getResponse = client.Get(ServiceUrl["Broker"] + entity.Id);

            updatedContract = getResponse.Content.ReadAsDataContract <EnergyTrading.MDM.Contracts.Sample.Broker>();
            content         = HttpContentExtensions.CreateDataContract(BrokerData.MakeChangeToContract(updatedContract));
        }
コード例 #7
0
        protected static void Establish_context()
        {
            client = new HttpClient();
            entity = BrokerData.CreateBasicEntity();
            var getResponse = client.Get(ServiceUrl["Broker"] + entity.Id);

            updatedContract = getResponse.Content.ReadAsDataContract<EnergyTrading.MDM.Contracts.Sample.Broker>();
            content = HttpContentExtensions.CreateDataContract(BrokerData.MakeChangeToContract(updatedContract));
        }
コード例 #8
0
        protected static void Establish_context()
        {
            entity = BrokerData.CreateBasicEntityWithOneMapping();
            client = new HttpClient();
            var notAMapping = new MDM.Broker();

            content      = HttpContentExtensions.CreateDataContract(notAMapping);
            startVersion = CurrentEntityVersion();
        }
コード例 #9
0
        protected static void Because_of()
        {
            entity = BrokerData.CreateEntityWithTwoDetailsAndTwoMappings();

            client = new HttpClient(ServiceUrl["Broker"] +
                                    "crossmap?source-system=trayport&destination-system=endur&mapping-string=" + entity.Mappings[0].MappingValue
                                    + "&as-of=" + entity.Mappings[0].Validity.Start.ToString(DateFormatString));

            response        = client.Get();
            mappingResponse = response.Content.ReadAsDataContract <EnergyTrading.Mdm.Contracts.MappingResponse>();
        }
コード例 #10
0
        protected static void Because_of()
        {
            entity = BrokerData.CreateEntityWithTwoDetailsAndTwoMappings();

            client = new HttpClient(ServiceUrl["Broker"] +
                "crossmap?source-system=trayport&destination-system=endur&mapping-string=" + entity.Mappings[0].MappingValue
                + "&as-of=" + entity.Mappings[0].Validity.Start.ToString(DateFormatString));

            response = client.Get();
            mappingResponse = response.Content.ReadAsDataContract<EnergyTrading.Mdm.Contracts.MappingResponse>();
        }
コード例 #11
0
        protected static void Establish_context()
        {
            entity1 = BrokerData.CreateBasicEntity();
            entity2 = BrokerData.CreateBasicEntity();

            client = new HttpClient();

            var search = new Search();
            BrokerData.CreateSearch(search, entity1, entity2);

            content = HttpContentExtensions.CreateDataContract(search);
        }
        protected static void Establish_context()
        {
            entity1 = BrokerData.CreateBasicEntityWithOneMapping();

            client = new HttpClient();

            Search search = SearchBuilder.CreateSearch(isMappingSearch: true);
            search.AddSearchCriteria(SearchCombinator.And).AddCriteria(
                "MappingValue", SearchCondition.Equals, entity1.Mappings[0].MappingValue).AddCriteria(
                    "System.Name", SearchCondition.Equals, "Endur");

            content = HttpContentExtensions.CreateDataContract(search);
        }
コード例 #13
0
        public void Map_NoConditions_MapsPartyIdToPartyName()
        {
            //Arrange
            var source = new MDM.Broker() { Party = new Party() { Id = 999 }, PartyRoleType = "Broker"};
            source.Party.AddDetails(new PartyDetails(){ Name = "999" });
            var mapper = new BrokerMapper();

            //Act
            var destination = mapper.Map(source);

            //Assert
            Assert.AreEqual("999", destination.Party.Name);
        }
コード例 #14
0
        protected static void Establish_context()
        {
            entity1 = BrokerData.CreateBasicEntity();
            entity2 = BrokerData.CreateBasicEntity();

            client = new HttpClient();

            var search = new Search();

            BrokerData.CreateSearch(search, entity1, entity2);

            content = HttpContentExtensions.CreateDataContract(search);
        }
        protected static void Establish_context()
        {
            entity1 = BrokerData.CreateBasicEntityWithOneMapping();

            client = new HttpClient();

            Search search = SearchBuilder.CreateSearch(isMappingSearch: true);

            search.AddSearchCriteria(SearchCombinator.And).AddCriteria(
                "MappingValue", SearchCondition.Equals, entity1.Mappings[0].MappingValue).AddCriteria(
                "System.Name", SearchCondition.Equals, "Endur");

            content = HttpContentExtensions.CreateDataContract(search);
        }
コード例 #16
0
        protected static void Establish_context()
        {
            entity  = BrokerData.CreateBasicEntity();
            mapping = new EnergyTrading.Mdm.Contracts.Mapping {
                SystemName             = "Endur",
                Identifier             = Guid.NewGuid().ToString(),
                SourceSystemOriginated = false,
                DefaultReverseInd      = false,
                StartDate = Script.baseDate,
                EndDate   = Script.baseDate.AddDays(2)
            };

            content = HttpContentExtensions.CreateDataContract(mapping);
            client  = new HttpClient();
        }
コード例 #17
0
        protected static void Establish_context()
        {
            entity = BrokerData.CreateBasicEntityWithOneMapping();
            currentTrayportMapping = entity.Mappings[0];

            mapping = new EnergyTrading.Mdm.Contracts.Mapping {
                SystemName             = currentTrayportMapping.System.Name,
                Identifier             = currentTrayportMapping.MappingValue,
                SourceSystemOriginated = currentTrayportMapping.IsMaster,
                DefaultReverseInd      = currentTrayportMapping.IsDefault,
                StartDate = currentTrayportMapping.Validity.Start,
                EndDate   = currentTrayportMapping.Validity.Finish.AddDays(2)
            };

            content = HttpContentExtensions.CreateDataContract(mapping);
            client  = new HttpClient();
        }
コード例 #18
0
        protected static void Establish_context()
        {
            entity = BrokerData.CreateBasicEntityWithOneMapping();
            currentTrayportMapping = entity.Mappings[0];

            mapping = new EnergyTrading.Mdm.Contracts.Mapping{

                    SystemName = currentTrayportMapping.System.Name,
                    Identifier = currentTrayportMapping.MappingValue,
                    SourceSystemOriginated = currentTrayportMapping.IsMaster,
                    DefaultReverseInd = currentTrayportMapping.IsDefault,
                    StartDate = currentTrayportMapping.Validity.Start,
                    EndDate = currentTrayportMapping.Validity.Finish.AddDays(2)
                };

            content = HttpContentExtensions.CreateDataContract(mapping);
            client = new HttpClient();
        }
コード例 #19
0
        public void Map_NoConditions_MapsPartyIdToPartyName()
        {
            //Arrange
            var source = new MDM.Broker()
            {
                Party = new Party()
                {
                    Id = 999
                }, PartyRoleType = "Broker"
            };

            source.Party.AddDetails(new PartyDetails()
            {
                Name = "999"
            });
            var mapper = new BrokerMapper();

            //Act
            var destination = mapper.Map(source);

            //Assert
            Assert.AreEqual("999", destination.Party.Name);
        }
コード例 #20
0
 protected static void Establish_context()
 {
     entity1 = BrokerData.CreateBasicEntity();
     entity2 = BrokerData.CreateBasicEntity();
 }
コード例 #21
0
        public void SuccessMatch()
        {
            // Arrange
            var validatorFactory = new Mock <IValidatorEngine>();
            var mappingEngine    = new Mock <IMappingEngine>();
            var repository       = new Mock <IRepository>();
            var searchCache      = new Mock <ISearchCache>();
            var service          = new BrokerService(validatorFactory.Object, mappingEngine.Object, repository.Object, searchCache.Object);

            // Domain details
            var system = new MDM.SourceSystem {
                Name = "Endur"
            };
            var mapping = new PartyRoleMapping
            {
                System       = system,
                MappingValue = "A"
            };
            var targetSystem = new MDM.SourceSystem {
                Name = "Trayport"
            };
            var targetMapping = new PartyRoleMapping
            {
                System       = targetSystem,
                MappingValue = "B",
                IsDefault    = true
            };
            var details = new MDM.BrokerDetails
            {
                Name = "Test",
            };
            var broker = new MDM.Broker
            {
                Id = 1
            };

            broker.AddDetails(details);
            broker.ProcessMapping(mapping);
            broker.ProcessMapping(targetMapping);

            // Contract details
            var targetIdentifier = new MdmId
            {
                SystemName = "Trayport",
                Identifier = "B"
            };

            mappingEngine.Setup(x => x.Map <PartyRoleMapping, MdmId>(targetMapping)).Returns(targetIdentifier);

            var list = new List <PartyRoleMapping> {
                mapping
            };

            repository.Setup(x => x.Queryable <PartyRoleMapping>()).Returns(list.AsQueryable());

            var request = new CrossMappingRequest
            {
                SystemName       = "Endur",
                Identifier       = "A",
                TargetSystemName = "trayport",
                ValidAt          = SystemTime.UtcNow(),
                Version          = 1
            };

            // Act
            var response  = service.CrossMap(request);
            var candidate = response.Contract;

            // Assert
            Assert.IsNotNull(response, "Contract null");
            Assert.IsTrue(response.IsValid, "Contract invalid");
            Assert.IsNotNull(candidate, "Mapping null");
            Assert.AreEqual(1, candidate.Mappings.Count, "Identifier count incorrect");
            Assert.AreSame(targetIdentifier, candidate.Mappings[0], "Different identifier assigned");
        }
コード例 #22
0
 protected static void Establish_context()
 {
     broker = BrokerData.CreateEntityWithTwoDetailsAndTwoMappings();
 }
コード例 #23
0
        public static void CompareContractWithEntityDetails(EnergyTrading.MDM.Contracts.Sample.Broker contract, MDM.Broker entity)
        {
            MDM.BrokerDetails correctDetail = null;

            if (entity.Details.Count == 1)
            {
                correctDetail = entity.Details[0] as MDM.BrokerDetails;
            }
            else
            {
                correctDetail = (MDM.BrokerDetails)entity.Details.Where(
                    x => x.Validity.Start >= contract.MdmSystemData.StartDate && x.Validity.Finish >= contract.MdmSystemData.EndDate).First();
            }

            Assert.AreEqual(contract.Details.Name, correctDetail.Name);
            Assert.AreEqual(contract.Details.Phone, correctDetail.Phone);
            Assert.AreEqual(contract.Details.Fax, correctDetail.Fax);
            Assert.AreEqual(contract.Details.Rate, correctDetail.Rate);
            Assert.AreEqual(contract.Party.MdmId(), entity.Party.Id);
        }
コード例 #24
0
 protected static void Because_of()
 {
     entity = BrokerData.CreateBasicEntity();
     client.DefaultHeaders.Add("If-Match", entity.Version.ToString());
     response = client.Post(ServiceUrl["Broker"] + entity.Id, content);
 }
コード例 #25
0
 protected static void Establish_context()
 {
     entity1 = BrokerData.CreateBasicEntity();
     entity2 = BrokerData.CreateBasicEntity();
 }
コード例 #26
0
 protected static void Because_of()
 {
     entity = BrokerData.CreateBasicEntity();
     client.DefaultHeaders.Add("If-Match", entity.Version.ToString());
     response = client.Post(ServiceUrl["Broker"] + entity.Id, content);
 }
コード例 #27
0
 protected static void Establish_context()
 {
     broker = BrokerData.CreateEntityWithTwoDetailsAndTwoMappings();
 }