Esempio n. 1
0
 public IDataEntity BuildEsfDataEntity(EsfData esfData)
 {
     return(new DataEntity(Attributes.EntityESFData)
     {
         Attributes = new Dictionary <string, IAttributeData>()
         {
             { Attributes.UnitCost, new AttributeData(esfData.UnitCost) },
             { Attributes.ESFDeliverableCode, new AttributeData(esfData.ESFDeliverableCode) },
             { Attributes.ESFDataPremiumFactor, new AttributeData(esfData.ESFDataPremiumFactor) },
             { Attributes.EffectiveContractStartDate, new AttributeData(esfData.EffectiveContractStartDate) },
             { Attributes.EffectiveContractEndDate, new AttributeData(esfData.EffectiveContractEndDate) }
         }
     });
 }
        public void BuildEsfDataEntity()
        {
            var esfData = new EsfData
            {
                CalcMethod = 1,
                EffectiveContractStartDate = new DateTime(2018, 1, 1),
                EffectiveContractEndDate   = new DateTime(2019, 1, 1),
                ESFDataPremiumFactor       = 1.0m,
                ESFDeliverableCode         = "1",
                UnitCost = 1.2m
            };

            var dataEntity = NewService().BuildEsfDataEntity(esfData);

            dataEntity.EntityName.Should().Be("ESFData");
            dataEntity.Attributes.Should().HaveCount(5);
            dataEntity.Attributes["EffectiveContractStartDate"].Value.Should().Be(esfData.EffectiveContractStartDate);
            dataEntity.Attributes["EffectiveContractEndDate"].Value.Should().Be(esfData.EffectiveContractEndDate);
            dataEntity.Attributes["ESFDataPremiumFactor"].Value.Should().Be(esfData.ESFDataPremiumFactor);
            dataEntity.Attributes["ESFDeliverableCode"].Value.Should().Be(esfData.ESFDeliverableCode);
            dataEntity.Attributes["UnitCost"].Value.Should().Be(esfData.UnitCost);
        }