public void Create_Returns400BadRequest()
        {
            //Arrange

            var userLoanInput = new UserLoan
            {
                Id              = 10,
                UserLoanNum     = "67853423187",
                InterestAmount  = 375,
                EarlyPaymentFee = 76,
                Balance         = 1990,
                AppliedForTopup = true,
                LoanMasterId    = 1,
                CreatedOn       = new DateTime(2019, 1, 1),
                UpdatedOn       = new DateTime(2019, 1, 1)
            };

            var mockUserLoanRepository = new Mock <IUserLoanRepository>();
            var mockAppLogger          = new Mock <IAppLogger>();
            //mockUserLoanRepository.Setup(x => x.Add(userLoanInput)).Returns(userLoanInput);

            var controller = new UserLoanController(mockAppLogger.Object, mockUserLoanRepository.Object);

            //Act
            var actual = controller.Create(userLoanInput);

            //Assert
            Assert.Null(actual.Value);
            var badRequestObjectResult = Assert.IsType <BadRequestObjectResult>(actual.Result);

            Assert.Equal(400, badRequestObjectResult.StatusCode);
        }
        public void Create_Successful()
        {
            //Arrange

            var userLoanInput = new UserLoan
            {
                UserLoanNum     = "67853423187",
                InterestAmount  = 375,
                EarlyPaymentFee = 76,
                Balance         = 1990,
                AppliedForTopup = true,
                LoanMasterId    = 1,
                CreatedOn       = new DateTime(2019, 1, 1),
                UpdatedOn       = new DateTime(2019, 1, 1)
            };

            var userLoanOutput = new UserLoan
            {
                Id              = 10,
                UserLoanNum     = "67853423187",
                InterestAmount  = 375,
                EarlyPaymentFee = 76,
                Balance         = 1990,
                AppliedForTopup = true,
                LoanMasterId    = 1,
                CreatedOn       = new DateTime(2019, 1, 1),
                UpdatedOn       = new DateTime(2019, 1, 1)
            };

            var mockUserLoanRepository = new Mock <IUserLoanRepository>();
            var mockAppLogger          = new Mock <IAppLogger>();

            mockUserLoanRepository.Setup(x => x.Add(userLoanInput)).Returns(userLoanOutput);

            var controller = new UserLoanController(mockAppLogger.Object, mockUserLoanRepository.Object);

            //Act
            var actual = controller.Create(userLoanInput);

            //Assert
            Assert.Same(userLoanOutput, actual.Value);
        }