예제 #1
0
        public async Task DeleteTest()
        {
            int id       = 2003;
            var response = await controller.Delete(id);

            //Assert.AreEqual<OkResult>(response);

            Assert.AreEqual(404, (((StatusCodeResult)response).StatusCode));
        }
예제 #2
0
        public async Task DeleteLoan()
        {
            var testId = 1;

            var deletedLoan = new Loan
            {
                Id              = 1,
                BorrowerName    = "Fizz",
                FundingAmount   = 1000,
                RepaymentAmount = 1200,
                Deleted         = true
            };

            var result = await _controller.Delete(testId) as ObjectResult;

            var actualResult = (Loan)result.Value;

            _repo.Verify(x => x.DeleteLoan(It.IsAny <int>()), Times.Once);

            Assert.IsType <OkObjectResult>(result);
            Assert.Equal(deletedLoan.BorrowerName, actualResult.BorrowerName);
            Assert.True(actualResult.Deleted);
        }