public async Task GetDefaultValues_Returns_DefaultValues() { var target = new CheckoutDataRepository(SetupAddressService(), SetupPaymentMethodService(), null); var defaultShippingAddress = await target.GetDefaultShippingAddressAsync(); var defaultBilingAddress = await target.GetDefaultBillingAddressAsync(); var defaultPaymentMethod = await target.GetDefaultPaymentMethodAsync(); Assert.IsNotNull(defaultShippingAddress); Assert.AreEqual(defaultShippingAddress.Id, "3"); Assert.IsNotNull(defaultBilingAddress); Assert.AreEqual(defaultBilingAddress.Id, "2"); Assert.IsNull(defaultPaymentMethod); }
public async Task SetDefaultEntity_SetsDefaultEntity() { var target = new CheckoutDataRepository(SetupAddressService(), SetupPaymentMethodService(), null); var defaultShippingAddress = await target.GetDefaultShippingAddressAsync(); var defaultBillingAddress = await target.GetDefaultBillingAddressAsync(); var defaultPaymentMethod = await target.GetDefaultPaymentMethodAsync(); Assert.IsNotNull(defaultShippingAddress); Assert.AreEqual(defaultShippingAddress.Id, "3"); Assert.IsNotNull(defaultBillingAddress); Assert.AreEqual(defaultBillingAddress.Id, "2"); Assert.IsNull(defaultPaymentMethod); await target.SetDefaultShippingAddressAsync("2"); await target.SetDefaultBillingAddressAsync("1"); await target.SetDefaultPaymentMethodAsync("1"); defaultShippingAddress = await target.GetDefaultShippingAddressAsync(); defaultBillingAddress = await target.GetDefaultBillingAddressAsync(); defaultPaymentMethod = await target.GetDefaultPaymentMethodAsync(); Assert.IsNotNull(defaultShippingAddress); Assert.AreEqual(defaultShippingAddress.Id, "2"); Assert.IsNotNull(defaultBillingAddress); Assert.AreEqual(defaultBillingAddress.Id, "1"); Assert.IsNotNull(defaultPaymentMethod); Assert.AreEqual(defaultPaymentMethod.Id, "1"); }