/// <inheritdoc/> public async Task UpdateContractReminderAsync(ContractReminderItem contractReminderItem) { _logger.LogInformation($"Updating LastEmailReminderSent and LastUpdatedAt."); await Patch($"/api/contractReminder", new ContractIdentifier { Id = contractReminderItem.Id, ContractNumber = contractReminderItem.ContractNumber, ContractVersion = contractReminderItem.ContractVersion }); }
public void UpdateLastEmailReminderSentAndLastUpdatedAtAsync_Test(HttpStatusCode httpStatusCode) { // Arrange Mock.Get(_contractsDataLogger) .Setup(p => p.LogInformation(It.IsAny <string>(), It.IsAny <object[]>())); if (httpStatusCode != HttpStatusCode.OK) { Mock.Get(_contractsDataLogger) .Setup(p => p.LogError(It.IsAny <ApiGeneralException>(), It.IsAny <string>(), It.IsAny <object[]>())); } var expectedContractRequest = new ContractReminderItem { Id = 1, ContractVersion = 1, ContractNumber = "Test1" }; ContractsDataService contractsDataService = CreateContractsDataService(); SetUpHttpMessageHandler(expectedContractRequest, httpStatusCode, $"/api/contractReminder", HttpMethod.Patch); //Act Func <Task> action = async() => await contractsDataService.UpdateContractReminderAsync(expectedContractRequest); // Assert switch (httpStatusCode) { case HttpStatusCode.OK: action.Should().NotThrow(); break; case HttpStatusCode.BadRequest: action.Should().Throw <ContractBadRequestClientException>(); break; case HttpStatusCode.NotFound: action.Should().Throw <ContractNotFoundClientException>(); break; case HttpStatusCode.PreconditionFailed: action.Should().Throw <ContractStatusClientException>(); break; case HttpStatusCode.Conflict: action.Should().Throw <ContractUpdateConcurrencyClientException>(); break; default: throw new NotImplementedException(); } _mockHttpMessageHandler.VerifyNoOutstandingExpectation(); VerifyAllMocks(); }