Esempio n. 1
0
        public void GetReturnsNotFound()
        {
            // Arrange
            var mock = new Mock <ILoanDataAccess>();

            mock.Setup(p => p.GetLoanListDetails("1")).Returns(new List <Loan>()
            {
                new Loan()
                {
                    UserName        = "******",
                    LoanName        = "Loan Name",
                    LoanID          = 1,
                    Balance         = 12,
                    Interest        = 21,
                    EarlyPaymentFee = 23,
                    PayOutCarryOver = 333
                }
            });

            // Act
            var result = new LoanController(mock.Object);
            IHttpActionResult actionResult = result.GetLoans("10");

            // Assert
            Assert.IsInstanceOfType(actionResult, typeof(NotFoundResult));
        }
Esempio n. 2
0
        public void Compare_Result_Of_GetLoans_by_ID_1()
        {
            // SetUp/ Arrange
            var mock = new Mock <ILoanDataAccess>();

            mock.Setup(p => p.GetLoanListDetails("1")).Returns(new List <Loan>()
            {
                new Loan()
                {
                    UserName        = "******",
                    LoanName        = "Loan Name",
                    LoanID          = 1,
                    Balance         = 12,
                    Interest        = 21,
                    EarlyPaymentFee = 23,
                    PayOutCarryOver = 333
                }
            });

            // Act
            LoanController loan   = new LoanController(mock.Object);
            var            result = loan.GetLoans("1") as OkNegotiatedContentResult <List <Loan> >;;

            // Asert
            Assert.IsNotNull(result);
            Assert.AreEqual(1, result.Content[0].LoanID);
        }
Esempio n. 3
0
        public void GetLoans_For_ID_1_Moq_DAL()
        {
            // SetUp/ Arrange
            var mock = new Mock <ILoanDataAccess>();

            mock.Setup(p => p.GetLoanListDetails("1")).Returns(new List <Loan>()
            {
                new Loan()
                {
                    UserName        = "******",
                    LoanName        = "Loan Name",
                    LoanID          = 1,
                    Balance         = 12,
                    Interest        = 21,
                    EarlyPaymentFee = 23,
                    PayOutCarryOver = 333
                }
            });

            // Act
            LoanController loan   = new LoanController(mock.Object);
            var            result = loan.GetLoans("1");

            // Asert
            Assert.IsNotNull(result);
            // Assert.AreEqual(1, result.)
        }