public async Task GetEntity_Returns_Entity() { var target = new CheckoutDataRepository(SetupAddressService(), SetupPaymentMethodService(), null); var shippingAddress = await target.GetShippingAddressAsync("3"); var bilingAddress = await target.GetBillingAddressAsync("2"); var paymentMethod = await target.GetPaymentMethodAsync("1"); Assert.AreEqual(shippingAddress.FirstName, "Anne"); Assert.AreEqual(bilingAddress.FirstName, "Jane"); Assert.AreEqual(paymentMethod.CardholderName, "John Doe"); }
public async Task SaveEntity_SavesEntity() { var target = new CheckoutDataRepository(SetupAddressService(), SetupPaymentMethodService(), null); await target.SaveShippingAddressAsync(new Address() { Id="test", FirstName = "TestFirstName", LastName = "TestLastName", AddressType = AddressType.Shipping}); await target.SaveBillingAddressAsync(new Address() { Id = "test", FirstName = "TestFirstName", LastName = "TestLastName", AddressType = AddressType.Billing }); await target.SavePaymentMethodAsync(new PaymentMethod() { Id = "test", CardNumber = "12345", CardVerificationCode = "1234", ExpirationMonth = "10", ExpirationYear = "2010", CardholderName = "TestCardholderName" }); var savedShippingAddress = await target.GetShippingAddressAsync("test"); var savedBillingAddress = await target.GetBillingAddressAsync("test"); var savedPaymentMethod = await target.GetPaymentMethodAsync("test"); Assert.IsNotNull(savedShippingAddress); Assert.IsNotNull(savedBillingAddress); Assert.IsNotNull(savedPaymentMethod); var shippingAddress = await target.GetShippingAddressAsync(savedShippingAddress.Id); var billingAddress = await target.GetBillingAddressAsync(savedBillingAddress.Id); var paymentMethod = await target.GetPaymentMethodAsync(savedPaymentMethod.Id); Assert.AreEqual(savedShippingAddress.Id, shippingAddress.Id); Assert.AreEqual(savedBillingAddress.Id, billingAddress.Id); Assert.AreEqual(savedPaymentMethod.Id, paymentMethod.Id); }