Пример #1
0
        public static void CompareContractWithSavedEntity(EnergyTrading.MDM.Contracts.Sample.Broker contract)
        {
            int id          = int.Parse(contract.Identifiers.Where(x => x.IsMdmId).First().Identifier);
            var savedEntity = new DbSetRepository(new DbContextProvider(() => new SampleMappingContext())).FindOne <MDM.Broker>(id);

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

            base.OnSetup();

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

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

            CompareContractWithEntityDetails(contract, savedEntity);
        }
Пример #5
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);
        }
Пример #6
0
 public void should_not_return_a_broker()
 {
     EnergyTrading.MDM.Contracts.Sample.Broker returnedBroker = null;
     try { returnedBroker = response.Content.ReadAsDataContract <EnergyTrading.MDM.Contracts.Sample.Broker>(); } catch { }
     Assert.IsNull(returnedBroker);
 }
 protected static void SetAdditionalData(Broker entity)
 {
     var party = PartyData.PostBasicEntity();
     entity.Party = party.ToMdmId().ToEntityId();
 }