public void Get_currencies_converterlayer_success() { var fakeGetCurrencies = GetCurrenciesFake(); var mock = new Mock <ICurrencyConverterService>(); mock.Setup(x => x.GetCurrencies()) .Returns(fakeGetCurrencies); var currencyController = new ConverterController(mock.Object); var currencies = currencyController.GetCurrencies(); Assert.Equal(fakeGetCurrencies, currencies); }
public void When_GetCurrencies_then_Returns_CurrencyList() { //Arrange var currencies = new List <Currency> { new Currency("GBP", "Pounds") }; var sut = new ConverterController(logger, currencyService, countryService); A.CallTo(() => currencyService.GetCurrenciesAsync()).Returns(currencies); //Act var result = sut.GetCurrencies().GetAwaiter().GetResult(); //Assert A.CallTo(() => currencyService.GetCurrenciesAsync()).MustHaveHappenedOnceExactly(); Assert.IsType <ActionResult <List <Currency> > >(result); Assert.NotNull(result); }