示例#1
0
        public void GetPaymentsByAcountNumSuccessReturn200withListObject()
        {
            var selectedAccNum = "123344233";
            var mockPaymentBAL = new Mock <IPaymentBAL>();

            mockPaymentBAL.Setup(x => x.GetPaymentByAccountNum(selectedAccNum)).Returns(_payments.FindAll(i => i.AccountNum == selectedAccNum));

            var mockLog           = new Mock <ILogger <PaymentController> >();
            var paymentController = new PaymentController(mockPaymentBAL.Object, mockLog.Object);
            var response          = paymentController.GetByAccountNum(selectedAccNum) as ObjectResult;

            Assert.AreEqual(200, response.StatusCode);
            Assert.IsNotNull(response.Value);
            var payments = response.Value as List <PaymentModel>;

            Assert.AreEqual(1, payments.Count);
        }