public void LastPaymentsActionProvider_AggregateException() { //Arrange var action = new LastPaymentsActionProvider(_mockVaService.Object, _mockValManager.Object, _mockRepo.Object, _log); //Act and Assert Assert.ThrowsException <AggregateException>(() => action.ProcessAction(null).Result, "Parameter is null. Invalid value."); }
public void LastPaymentsActionProvider_Successful() { //Arrange var action = new LastPaymentsActionProvider(_mockVaService.Object, _mockValManager.Object, _mockRepo.Object, _log); //Act var result = action.ProcessAction(_repoPayment.UserId.ToString()).Result; //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(RepoModel.Payment)); Assert.IsTrue(((RepoModel.Payment)result).PaymentId == _repoPayment.PaymentId); Assert.IsTrue(((RepoModel.Payment)result).UserId == _repoPayment.UserId); }
public void LastPaymentsActionProvider_ValidationService_Failed() { //Mock //Returns an error result in validation var mockValService = new Mock <IValidationService>(); mockValService.Setup(v => v.ProcessValidation(_mockValManager.Object, It.IsAny <string>())).Returns( Task.FromResult(new Result { ErrorCode = ErrorCode.NoAuthorized, StatusCode = StatusCode.Failed, StatusDetail = "Test User No Authorized" } as object)); //Arrange var action = new LastPaymentsActionProvider(mockValService.Object, _mockValManager.Object, _mockRepo.Object, _log); //Act var result = action.ProcessAction(_apiPayment.UserId.ToString()).Result; //Assert Assert.IsNotNull(result); Assert.IsInstanceOfType(result, typeof(Result)); Assert.IsTrue(((Result)result).StatusCode == StatusCode.Failed); Assert.IsTrue(((Result)result).ErrorCode == ErrorCode.NoAuthorized); }