public void RequestIdInResponseShouldMatchWithRequestParam() { // given var id = int.Parse(sourcesystem.ToMdmId().Identifier); var mdmReqInfo = new MdmRequestInfo { RequestId = "Test123" }; // when var response = MdmService.Get <SourceSystem>(id); var entity = response.Message; entity.Identifiers = new MdmIdList() { entity.Identifiers.SystemId() }; // then response = MdmService.Update(id, entity, response.Tag, mdmReqInfo); Assert.IsTrue(response.IsValid && response.RequestId == mdmReqInfo.RequestId, "###Error : " + response.Code + " : " + (response.Fault == null ? string.Empty : response.Fault.Message + " : " + response.Fault.Reason)); var mappingId = Guid.NewGuid().ToString(); var mdmUpdateResponse = MdmService.CreateMapping <SourceSystem>(id, new MdmId { SystemName = "Endur", Identifier = mappingId }, mdmReqInfo); Assert.IsTrue(mdmUpdateResponse.IsValid && mdmUpdateResponse.RequestId == mdmReqInfo.RequestId, "###Error : " + response.Code + " : " + (response.Fault == null ? string.Empty : response.Fault.Message + " : " + response.Fault.Reason)); if (mdmUpdateResponse.Message != null && mdmUpdateResponse.Message.MappingId.HasValue) { var mdmDeleteResponse = MdmService.DeleteMapping <SourceSystem>(id, (int)mdmUpdateResponse.Message.MappingId.Value, mdmReqInfo); Assert.IsTrue(mdmDeleteResponse.IsValid && mdmDeleteResponse.RequestId == mdmReqInfo.RequestId, "###Error : " + response.Code + " : " + (response.Fault == null ? string.Empty : response.Fault.Message + " : " + response.Fault.Reason)); } }
public void ShouldCrossMap() { // given var sourceIdentifier = sourcesystem.Identifiers.First(i => i.SystemName == "Endur"); // when var response = MdmService.CrossMap <SourceSystem>(sourceIdentifier, "Trayport"); // then Assert.IsTrue(response.IsValid, "###Error : " + response.Code + " : " + (response.Fault == null ? string.Empty : response.Fault.Message + " : " + response.Fault.Reason)); Assert.AreEqual(sourcesystem.Identifiers.First(i => i.SystemName == "Trayport").Identifier, response.Message.Mappings[0].Identifier); }
public void ShouldMap() { // given var id = int.Parse(sourcesystem.ToMdmId().Identifier); // when var response = MdmService.Map <SourceSystem>(id, "Endur"); // then Assert.IsTrue(response.IsValid, "###Error : " + response.Code + " : " + (response.Fault == null ? string.Empty : response.Fault.Message + " : " + response.Fault.Reason)); Assert.AreEqual(sourcesystem.Identifiers.First(i => i.SystemName == "Endur").Identifier, response.Message.Identifier); }
public void ShouldGetByMdmId() { // given var nexusId = sourcesystem.ToMdmId(); // when var response = MdmService.Get <SourceSystem>(nexusId); // then Assert.IsTrue(response.IsValid, "###Error : " + response.Code + " : " + (response.Fault == null ? string.Empty : response.Fault.Message + " : " + response.Fault.Reason)); Check(sourcesystem, response.Message); }
public void ShouldGetByIntId() { // given var id = int.Parse(sourcesystem.ToMdmId().Identifier); // when var response = MdmService.Get <SourceSystem>(id); // then Assert.IsTrue(response.IsValid, "###Error : " + response.Code + " : " + (response.Fault == null ? string.Empty : response.Fault.Message + " : " + response.Fault.Reason)); Check(sourcesystem, response.Message); }
public void ShouldFailUpdateWhenETagDiffers() { // given var id = int.Parse(sourcesystem.ToMdmId().Identifier); // when var response = MdmService.Get <SourceSystem>(id); // then response = MdmService.Update(id, response.Message, "\"999888777666555\""); Assert.IsFalse(response.IsValid); Assert.AreEqual(HttpStatusCode.PreconditionFailed, response.Code); Assert.AreEqual("Exception of type 'EnergyTrading.Mdm.Services.VersionConflictException' was thrown.", response.Fault.Message); }
public void ShouldSucceedUpdateWhenETagMatches() { // given var id = int.Parse(sourcesystem.ToMdmId().Identifier); // when var response = MdmService.Get <SourceSystem>(id); var entity = response.Message; entity.Identifiers = new MdmIdList() { entity.Identifiers.SystemId() }; // then response = MdmService.Update(id, entity, response.Tag); Assert.IsTrue(response.IsValid, "###Error : " + response.Code + " : " + (response.Fault == null ? string.Empty : response.Fault.Message + " : " + response.Fault.Reason)); }