public static void CompareContractWithSavedEntity(EnergyTrading.MDM.Contracts.Sample.Exchange contract) { int id = int.Parse(contract.Identifiers.Where(x => x.IsMdmId).First().Identifier); var savedEntity = new DbSetRepository(new DbContextProvider(() => new SampleMappingContext())).FindOne <MDM.Exchange>(id); CompareContractWithEntityDetails(contract, savedEntity); }
protected override void OnSetup() { ConfigurationManager.AppSettings["MdmCaching"] = false.ToString(); base.OnSetup(); this.expected = ExchangeData.PostBasicEntity(); }
partial void AddRelatedEntities(EnergyTrading.MDM.Contracts.Sample.Exchange contract) { contract.Party = new EntityId() { Identifier = new MdmId() { IsMdmId = true, Identifier = "1" } }; }
public static void ConfirmEntitySaved(int id, EnergyTrading.MDM.Contracts.Sample.Exchange contract) { var savedEntity = new DbSetRepository(new DbContextProvider(() => new SampleMappingContext())).FindOne <MDM.Exchange>(id); contract.Identifiers.Add(new MdmId() { IsMdmId = true, Identifier = id.ToString() }); CompareContractWithEntityDetails(contract, savedEntity); }
public static void CompareContractWithEntityDetails(EnergyTrading.MDM.Contracts.Sample.Exchange contract, MDM.Exchange entity) { MDM.ExchangeDetails correctDetail = null; if (entity.Details.Count == 1) { correctDetail = entity.Details[0] as MDM.ExchangeDetails; } else { correctDetail = (MDM.ExchangeDetails)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.Party.MdmId(), entity.Party.Id); }
protected static void SetAdditionalData(Exchange entity) { entity.Party = IntegrationTests.Party.PartyData.PostBasicEntity().ToMdmId().ToEntityId(); }
public void should_not_return_a_exchange() { EnergyTrading.MDM.Contracts.Sample.Exchange returnedExchange = null; try { returnedExchange = response.Content.ReadAsDataContract <EnergyTrading.MDM.Contracts.Sample.Exchange>(); } catch { } Assert.IsNull(returnedExchange); }