Esempio n. 1
0
        public void PaymentController_GetLastPayment_NullReferenceException_Failed()
        {
            //Arrange
            var controller = new PaymentController(_mockActService.Object, _log);

            //Act and Assert
            Assert.ThrowsExceptionAsync <NullReferenceException>(() => controller.GetLastPayment("Exception"), "Test Null Exception.");
        }
Esempio n. 2
0
        public void PaymentController_GetLastPayment_Null_Failed()
        {
            //Arrange
            var controller = new PaymentController(_mockActService.Object, _log);
            //Act
            var result = controller.GetLastPayment(null).Result;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsFalse(result.Success);
            Assert.IsTrue(result.TotalRecords == 0);
            Assert.IsNull(result.Data);
            Assert.IsTrue(string.IsNullOrEmpty(result.ErrorCode));
            Assert.IsTrue(string.IsNullOrEmpty(result.ErrorMessage));
            Assert.IsTrue(string.IsNullOrEmpty(result.ErrorStackTrace));
        }
Esempio n. 3
0
        public void PaymentController_GetLastPayment_Error_Failed()
        {
            //Arrange
            var controller = new PaymentController(_mockActService.Object, _log);
            //Act
            var result = controller.GetLastPayment("TEST_1234567890").Result;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsFalse(result.Success);
            Assert.IsTrue(result.TotalRecords == 1);
            Assert.IsNotNull(result.Data);
            Assert.IsTrue(((Result)result.Data).ErrorCode == ErrorCode.InvalidValue);
            Assert.IsTrue(((Result)result.Data).StatusCode == StatusCode.Failed);
            Assert.IsTrue(result.ErrorCode == "301");
            Assert.IsTrue(!string.IsNullOrEmpty(result.ErrorMessage));
        }
Esempio n. 4
0
        public void PaymentController_GetLastPayment_Successful()
        {
            //Arrange
            var controller = new PaymentController(_mockActService.Object, _log);
            //Act
            var result = controller.GetLastPayment(_userId.ToString()).Result;

            //Assert
            Assert.IsNotNull(result);
            Assert.IsTrue(result.Success);
            Assert.IsTrue(result.TotalRecords == 1);
            Assert.IsNotNull(result.Data);
            Assert.IsInstanceOfType(result.Data, typeof(ApiModel.Payment));
            Assert.AreEqual(((ApiModel.Payment)result.Data).PaymentId, _repoPayment.PaymentId);
            Assert.IsTrue(string.IsNullOrEmpty(result.ErrorCode));
            Assert.IsTrue(string.IsNullOrEmpty(result.ErrorMessage));
            Assert.IsTrue(string.IsNullOrEmpty(result.ErrorStackTrace));
        }