public async Task GetAvailableCurrenciesReturnsEmptyArrayGivenNoCurrencyIsRegistered() { //Arrange var context = CreateEmptyContext(); var service = new CurrencyReadingService(context); //Act var currencies = await service.GetAvailableCurrenciesAsync(); //Assert Assert.IsNotNull(currencies); Assert.AreEqual(0, currencies.Length); }
public async Task GetAvailableCurrenciesReturnsEmptyArrayGivenNoCurrencyIsEnabled() { //Arrange var context = CreateEmptyContext(); context.CurrencySymbols.Add(new CurrencySymbol("USD") { Enabled = false }); await context.SaveChangesAsync(); var service = new CurrencyReadingService(context); //Act var currencies = await service.GetAvailableCurrenciesAsync(); //Assert Assert.IsNotNull(currencies); Assert.AreEqual(0, currencies.Length); }
public async Task GetAvailableCurrenciesReturnsGivenCurrencyAreEnabled() { //Arrange var context = CreateEmptyContext(); context.CurrencySymbols.Add(new CurrencySymbol("USD")); context.CurrencySymbols.Add(new CurrencySymbol("EUR")); await context.SaveChangesAsync(); var service = new CurrencyReadingService(context); //Act var currencies = await service.GetAvailableCurrenciesAsync(); //Assert Assert.IsNotNull(currencies); Assert.AreEqual(2, currencies.Length); Assert.IsTrue(currencies.Contains("USD")); Assert.IsTrue(currencies.Contains("EUR")); }
public async Task <IActionResult> Get() { var currencies = await _service.GetAvailableCurrenciesAsync(); return(Ok(currencies)); }