public void Write_SetPayment_Amount_Not_Present() { // Arrange var request = new SetPayment() { Meta = { MerchantId = 7454 }, Payment = { PaymentProductId = 123, OrderId = 1200003770 } }; // Act var text = ConvertApiDataPartToString(request); var request2 = new SetPayment(); request2.FromModifiedXml(new ModifiedXmlDocument(text), string.Empty); // Assert Assert.AreEqual(7454, request2.Meta.MerchantId); Assert.IsFalse(request2.Payment.Amount.HasValue); Assert.AreEqual(123, request2.Payment.PaymentProductId); Assert.AreEqual(1200003770, request2.Payment.OrderId); }
public void Write_Then_Read_SetPayment() { // Arrange var request = new SetPayment { Meta = { MerchantId = 7454 }, Payment = { Amount = 12345, CountryCode = "DK", OrderId = 1234, MerchantReference = "MyPaymentReference", EffortId = 1 } }; // Act var text = ConvertApiDataPartToString(request); var request2 = new SetPayment(); request2.FromModifiedXml(new ModifiedXmlDocument(text), string.Empty); // Assert Assert.AreEqual(7454, request2.Meta.MerchantId); Assert.AreEqual(12345, request2.Payment.Amount); Assert.AreEqual("DK", request2.Payment.CountryCode); Assert.AreEqual(1234, request2.Payment.OrderId); Assert.AreEqual("MyPaymentReference", request2.Payment.MerchantReference); Assert.AreEqual(1, request2.Payment.EffortId); }