public async Task <IEnumerable <UserRateAmountDTO> > GetUserRateAmount()
        {
            var currentUser = await _userManager.FindByNameAsync(User?.Identity?.Name);

            var rateAmounts = _context.UserRateAmount.Include(rateAmount => rateAmount.RateType)
                              .Where(rateAmount => rateAmount.UserId.Equals(currentUser.Id)).ToList();

            var dtos = ModelToDto.RateAmountsToDtos(rateAmounts);

            return(dtos);
        }
Esempio n. 2
0
        public void RateAmountsToDTOs_Should_ReturnValidDTOCollection()
        {
            var mockRateAmounts = CreateMockRateAmounts();

            var sut = ModelToDto.RateAmountsToDtos(mockRateAmounts).ToList();

            Assert.AreEqual(sut.Count, 2);
            Assert.AreEqual(sut.ElementAt(0).RateAmount, 200);
            Assert.AreEqual(sut.ElementAt(1).RateAmount, 239);
            Assert.AreEqual(sut.ElementAt(0).RateName, "Test Rate Type");
            Assert.AreEqual(sut.ElementAt(1).RateName, "Test Rate Type");
        }