コード例 #1
0
        public async Task <decimal> CalculateInterest(IInterestRateQueryApi interestRateQueryApi)
        {
            var interestRate = await interestRateQueryApi.GetInterestRateAsync();

            var simpleInterest =
                Decimal.Multiply(Amount, (decimal)Math.Pow((double)(1 + interestRate), Months));

            return(simpleInterest.TruncateInTwoPlaces());
        }
コード例 #2
0
        public async Task Test_Some_Http_Calling_Method()
        {
            using var httpTest = new HttpTest();

            var result = await _interestRateQueryApi.GetInterestRateAsync();

            httpTest
            .ShouldHaveCalled(
                $"{_interestRateApiQueryConfigMock.Value.Host}/{_interestRateApiQueryConfigMock.Value.Path}")
            .With(x => x.Response.IsSuccessStatusCode)
            .WithVerb(HttpMethod.Get)
            .Times(1);

            result.Should().NotBe(null).And.BeOfType(typeof(decimal));
        }