public static void CompareContractWithSavedEntity(EnergyTrading.MDM.Contracts.Sample.Counterparty contract)
        {
            int id          = int.Parse(contract.Identifiers.Where(x => x.IsMdmId).First().Identifier);
            var savedEntity = new DbSetRepository(new DbContextProvider(() => new SampleMappingContext())).FindOne <MDM.Counterparty>(id);

            CompareContractWithEntityDetails(contract, savedEntity);
        }
        protected override void OnSetup()
        {
            ConfigurationManager.AppSettings["MdmCaching"] = false.ToString();

            base.OnSetup();

            this.expected = CounterpartyData.PostBasicEntity();
        }
Пример #3
0
 partial void AddRelatedEntities(EnergyTrading.MDM.Contracts.Sample.Counterparty contract)
 {
     contract.Party = new EntityId()
     {
         Identifier = new MdmId()
         {
             IsMdmId = true, Identifier = "1"
         }
     };
 }
        public static void ConfirmEntitySaved(int id, EnergyTrading.MDM.Contracts.Sample.Counterparty contract)
        {
            var savedEntity =
                new DbSetRepository(new DbContextProvider(() => new SampleMappingContext())).FindOne <MDM.Counterparty>(id);

            contract.Identifiers.Add(new MdmId()
            {
                IsMdmId = true, Identifier = id.ToString()
            });

            CompareContractWithEntityDetails(contract, savedEntity);
        }
        public static void CompareContractWithEntityDetails(EnergyTrading.MDM.Contracts.Sample.Counterparty contract, MDM.Counterparty entity)
        {
            MDM.CounterpartyDetails correctDetail = null;

            if (entity.Details.Count == 1)
            {
                correctDetail = entity.Details[0] as MDM.CounterpartyDetails;
            }
            else
            {
                correctDetail = (MDM.CounterpartyDetails)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.ShortName, correctDetail.ShortName);
            //Assert.AreEqual(contract.Details.TaxLocation.MdmId().Value, correctDetail.TaxLocation.Id);
            Assert.AreEqual(contract.Party.MdmId().Value, entity.Party.Id);
        }
 protected static void SetAdditionalData(Counterparty entity)
 {
     entity.Party = IntegrationTests.Party.PartyData.PostBasicEntity().ToMdmId().ToEntityId();
 }
 public void should_not_return_a_counterparty()
 {
     EnergyTrading.MDM.Contracts.Sample.Counterparty returnedCounterparty = null;
     try { returnedCounterparty = response.Content.ReadAsDataContract <EnergyTrading.MDM.Contracts.Sample.Counterparty>(); } catch { }
     Assert.IsNull(returnedCounterparty);
 }