public async Task SharedFundController_Withdraw() { const int employeeId = 1; var result = new Result(500M); _sharedFundAppService.Setup(s => s.Withdraw(employeeId)).Returns(result); _sharedFundController = new SharedFundController(_sharedFundAppService.Object); var objectResult = await _sharedFundController.Withdraw(employeeId); Assert.NotNull(objectResult); Assert.Equal((int)HttpStatusCode.OK, objectResult.StatusCode); Assert.Equal(result.Return, ((Result)objectResult.Value).Return); }
public async Task SharedFundController_Add() { var result = new Result(1); var sharedFund = new SharedFund { EmployeeId = 1, Value = 200M, ContributionDate = DateTime.Now }; _sharedFundAppService.Setup(s => s.Add(sharedFund)).Returns(result); _sharedFundController = new SharedFundController(_sharedFundAppService.Object); var objectResult = await _sharedFundController.Add(sharedFund); Assert.NotNull(objectResult); Assert.Equal((int)HttpStatusCode.OK, objectResult.StatusCode); Assert.Equal(result.Return, ((Result)objectResult.Value).Return); }
public async Task SharedFundController_GetBalance() { const int employeeId = 1; var sharedFunds = new List <SharedFund> { new SharedFund { EmployeeId = 1, Value = 200M, ContributionDate = DateTime.Now } }; var result = new Result(sharedFunds); _sharedFundAppService.Setup(s => s.GetBalance(employeeId)).Returns(result); _sharedFundController = new SharedFundController(_sharedFundAppService.Object); var objectResult = await _sharedFundController.GetBalance(employeeId); Assert.NotNull(objectResult); Assert.Equal((int)HttpStatusCode.OK, objectResult.StatusCode); Assert.Equal(result.Return, ((Result)objectResult.Value).Return); }