protected static void Establish_context() { entity = BrokerData.CreateBasicEntity(); var notAMapping = new EnergyTrading.MDM.Contracts.Sample.Broker(); content = HttpContentExtensions.CreateDataContract(notAMapping); client = new HttpClient(); }
protected static void Establish_context() { client = new HttpClient(); entity = BrokerData.CreateBasicEntity(); content = HttpContentExtensions.CreateDataContract(new EnergyTrading.MDM.Contracts.Sample.Broker()); startVersion = CurrentEntityVersion(); }
protected static void Establish_context() { entity = BrokerData.CreateBasicEntityWithOneMapping(); client = new HttpClient(); var notAMapping = new MDM.Broker(); content = HttpContentExtensions.CreateDataContract(notAMapping); startVersion = CurrentEntityVersion(); }
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)); }
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)); }
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>(); }
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>(); }
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); }
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); }
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(); }
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(); }
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(); }
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); }
protected static void Establish_context() { entity1 = BrokerData.CreateBasicEntity(); entity2 = BrokerData.CreateBasicEntity(); }
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"); }
protected static void Establish_context() { broker = BrokerData.CreateEntityWithTwoDetailsAndTwoMappings(); }
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); }
protected static void Because_of() { entity = BrokerData.CreateBasicEntity(); client.DefaultHeaders.Add("If-Match", entity.Version.ToString()); response = client.Post(ServiceUrl["Broker"] + entity.Id, content); }