public void Serialize_Deserialize_ChargeItem_ShouldReturn_InitialClass() { var chargeItem = new ifPOS.v0.ChargeItem(); chargeItem.Position = 0; var stream1 = new MemoryStream(); var serializer = new DataContractSerializer(typeof(ifPOS.v0.ChargeItem)); serializer.WriteObject(stream1, chargeItem); stream1.Position = 0; var xmlChargeItem = (ifPOS.v0.ChargeItem)serializer.ReadObject(stream1); xmlChargeItem.Position.Should().Be(chargeItem.Position); xmlChargeItem.Quantity.Should().Be(chargeItem.Quantity); xmlChargeItem.Description.Should().Be(chargeItem.Description); xmlChargeItem.Amount.Should().Be(chargeItem.Amount); xmlChargeItem.VATRate.Should().Be(chargeItem.VATRate); xmlChargeItem.ftChargeItemCase.Should().Be(chargeItem.ftChargeItemCase); xmlChargeItem.ftChargeItemCaseData.Should().Be(chargeItem.ftChargeItemCaseData); xmlChargeItem.VATAmount.Should().Be(chargeItem.VATAmount); xmlChargeItem.AccountNumber.Should().Be(chargeItem.AccountNumber); xmlChargeItem.CostCenter.Should().Be(chargeItem.CostCenter); xmlChargeItem.ProductGroup.Should().Be(chargeItem.ProductGroup); xmlChargeItem.ProductNumber.Should().Be(chargeItem.ProductNumber); xmlChargeItem.ProductBarcode.Should().Be(chargeItem.ProductBarcode); xmlChargeItem.Unit.Should().Be(chargeItem.Unit); xmlChargeItem.UnitQuantity.Should().Be(chargeItem.UnitQuantity); xmlChargeItem.UnitPrice.Should().Be(chargeItem.UnitPrice); xmlChargeItem.Moment.Should().Be(chargeItem.Moment); }
public static ifPOS.v1.ChargeItem Into(this ifPOS.v0.ChargeItem from) { return(new ifPOS.v1.ChargeItem { Position = from.Position, Quantity = from.Quantity, Description = from.Description, Amount = from.Amount, VATRate = from.VATRate, ftChargeItemCase = from.ftChargeItemCase, ftChargeItemCaseData = from.ftChargeItemCaseData, VATAmount = from.VATAmount, AccountNumber = from.AccountNumber, CostCenter = from.CostCenter, ProductGroup = from.ProductGroup, ProductNumber = from.ProductNumber, ProductBarcode = from.ProductBarcode, Unit = from.Unit, UnitQuantity = from.UnitQuantity, UnitPrice = from.UnitPrice, Moment = from.Moment, }); }