示例#1
0
        public void GetLoansForTomeTest()
        {
            int tomeId     = 2;
            var controller = new LoansController(_entityMock.Object);
            var result     = controller.GetLoansForTome(tomeId);

            var objectResult = Assert.IsType <OkObjectResult>(result);
            var model        = Assert.IsAssignableFrom <IEnumerable <LoanDTO> >(objectResult.Value);

            Assert.Equal(_loanDTOs.Where(l => l.TomeId == 2 && l.LastDay >= DateTime.Now).Select(l => l.Id), model.Select(l => l.Id));
        }
示例#2
0
        public void GetLoansForTomeTest2()
        {
            int tomeId     = 3;
            var controller = new LoansController(_entityMock.Object);
            var result     = controller.GetLoansForTome(tomeId);

            var objectResult = Assert.IsType <OkObjectResult>(result);
            var model        = Assert.IsAssignableFrom <IEnumerable <LoanDTO> >(objectResult.Value);

            foreach (var loan in _loanDTOs)
            {
                Debug.WriteLine(loan.LastDay);
            }

            Assert.Equal(_loanDTOs.Where(l => l.TomeId == 3 && l.LastDay >= DateTime.Now).Select(l => l.Id).ToList(), model.Select(l => l.Id).ToList());
        }