public void ProcessMessage_Approved_ReturnsExpectedResult(ContractParentStatus parentStatus, ContractStatus contractStatus, ContractAmendmentType amendmentType) { // Arrange Mock.Get(_mockContractServiceLogger) .Setup(l => l.LogInformation(It.IsAny <string>())); var dummyContractEvent = GetContractEvent(parentStatus, contractStatus, amendmentType); ClientData.Models.Contract dummyContract = GetClientContract(); Mock.Get(_mockContractApprovalService) .Setup(s => s.ApproveAsync(It.IsAny <ContractEvent>(), It.IsAny <Contract>())) .ReturnsAsync(true) .Verifiable(); Mock.Get(_mockContractsDataService) .Setup(s => s.TryGetContractAsync(It.IsAny <string>(), It.IsAny <int>())) .ReturnsAsync(dummyContract) .Verifiable(); var contractService = new ContractService(_mockContractServiceLogger, _mockContractsDataService, _mockContractApprovalService, _mockContractsWithdrawService, _mockContractCreationService); // Act contractService.ProcessMessage(dummyContractEvent).GetAwaiter().GetResult(); // Assert Mock.Get(_mockContractsDataService) .Verify(s => s.TryGetContractAsync(It.IsAny <string>(), It.IsAny <int>()), Times.Once); Mock.Get(_mockContractServiceLogger).VerifyAll(); }
private void MockContractsDataService_GetContractAsync(ClientData.Models.Contract contract) { Mock.Get(_mockContractsDataService) .Setup(x => x.GetContractAsync(It.IsAny <string>(), It.IsAny <int>())) .ReturnsAsync(contract) .Verifiable(); }