Exemplo n.º 1
0
        public async Task GetQuotationInformation_NotAvailableCurrencyException()
        {
            var currency             = "Real";
            var quotationInformation = quotationFakeData.GetCorrectQuotationInformation();
            var quotationResponse    = quotationFakeData.GetCorrectQuotationResponse();

            apiClient.Setup(a => a.GetAsync <List <string> >(quotationUrl))
            .ReturnsAsync(quotationInformation);
            quotationDomainMock.Setup(q => q.GetQuotation(currency))
            .ThrowsAsync(new NotAvailableCurrencyException(It.IsAny <string>()));

            var domain = new QuotationDomain(apiClient.Object);
            var result = await domain.GetQuotation(currency);
        }
Exemplo n.º 2
0
        public async Task GetQuotationInformationOk()
        {
            var currency             = "Dolar";
            var quotationInformation = quotationFakeData.GetCorrectQuotationInformation();
            var quotationResponse    = quotationFakeData.GetCorrectQuotationResponse();

            apiClient.Setup(a => a.GetAsync <List <string> >(quotationUrl))
            .ReturnsAsync(quotationInformation);
            quotationDomainMock.Setup(q => q.GetQuotation(currency))
            .ReturnsAsync(quotationResponse);

            var domain = new QuotationDomain(apiClient.Object);
            var result = await domain.GetQuotation(currency);

            Assert.IsNotNull(result);
            Assert.AreEqual(result.PurchasePrice, quotationResponse.PurchasePrice);
            Assert.AreEqual(result.SalePrice, quotationResponse.SalePrice);
        }