public async Task FindCurrencySymbol_WithNullSymbol() { // arrange var vm = new CurrencyConverterViewModel(_testClient); await vm.Initialize().ConfigureAwait(false); vm.ConvertToCurrencyId = "PES"; // act var result = vm.ConvertToCurrencySymbol; // assert Assert.Empty(result); }
public async Task Initialize() { // arrange var vm = new CurrencyConverterViewModel(_testClient); // act await vm.Initialize().ConfigureAwait(false); // assert Assert.NotNull(vm); Assert.Equal(0, vm.ConvertFromValue); Assert.Equal("USD", vm.ConvertFromCurrencyId); Assert.Equal("$", vm.ConvertFromCurrencySymbol); Assert.Equal(0.0M, vm.ConvertToValue); Assert.Equal("EUR", vm.ConvertToCurrencyId); Assert.Equal("E", vm.ConvertToCurrencySymbol); Assert.Equal(5, vm.Currencies.Count()); Assert.Null(vm.ConversionRate); Assert.Null(vm.ErrorMessage); Assert.False(vm.HasError); }
public async Task Initialize_WithServiceError() { // arrange var vm = new CurrencyConverterViewModel(_errorClient); // act await vm.Initialize().ConfigureAwait(false); // assert Assert.NotNull(vm); Assert.Equal(0, vm.ConvertFromValue); Assert.Null(vm.ConvertFromCurrencyId); Assert.Empty(vm.ConvertFromCurrencySymbol); Assert.Equal(0.0M, vm.ConvertToValue); Assert.Null(vm.ConvertToCurrencyId); Assert.Empty(vm.ConvertToCurrencySymbol); Assert.Empty(vm.Currencies); Assert.Null(vm.ConversionRate); Assert.NotEmpty(vm.ErrorMessage); Assert.True(vm.HasError); }