public void OnNavigateTo_LoadsDefault_IfTryLoadDefaultTrue() { var defaultAddress = new Address { FirstName = "FirstName", State = "WA" }; var checkoutDataRepository = new MockCheckoutDataRepository(); checkoutDataRepository.GetDefaultBillingAddressAsyncDelegate = () => Task.FromResult(defaultAddress); var locationService = new MockLocationService(); var resourceLoader = new MockResourceLoader(); var target = new BillingAddressUserControlViewModel(checkoutDataRepository, locationService, resourceLoader, null); target.OnNavigatedTo(new NavigatedToEventArgs { Parameter = null, NavigationMode = NavigationMode.New }, new Dictionary <string, object>()); Assert.IsNull(target.Address.FirstName); target.SetLoadDefault(true); target.OnNavigatedTo(new NavigatedToEventArgs { Parameter = null, NavigationMode = NavigationMode.New }, new Dictionary <string, object>()); Assert.AreEqual("FirstName", target.Address.FirstName); }
public void TEST_FILTER_LOCATIONS_RETURN_AIRPORTS() { var expected = 1; var locations = new Location[] { new Location() { iata = "BIU", lon = "-23.983334", iso = "IS", status = 1, name = "Bildudalur Airport", continent = "EU", type = "airport", lat = "65.833336", size = "small" }, new Location() { iata = "BJD", lon = "-14.75", iso = "IS", status = 1, name = null, continent = "EU", type = "airport", lat = "66.066666", size = "small" } }; var service = new MockLocationService(); var result = service.FilterLocations(locations); Assert.AreEqual(expected, result.Length); }