public async Task AzureStorageResultPlugin_should_always_save_failed_result_blob() { // arrange var storageService = new Mock <IStorageService>(); var plugin = new AzureStorageResultPlugin(storageService.Object); HealthCheckAzureStorageConfigurations.Instance.AzureStorageConnectionString = "cs"; // act await plugin.ActionAfterResult(new HealthyResponse { Success = false }); // assert storageService.Verify(c => c.PersistBlobResult(It.IsAny <HealthyResponse>()), Times.Once); }
public async Task AzureStorageResultPlugin_should_avoid_save_blob_if_only_failed_results_needs_be_saved() { // arrange var storageService = new Mock <IStorageService>(); var plugin = new AzureStorageResultPlugin(storageService.Object); HealthCheckAzureStorageConfigurations.Instance.OnlyTrackFailedResults = true; HealthCheckAzureStorageConfigurations.Instance.AzureStorageConnectionString = "cs"; // act await plugin.ActionAfterResult(new HealthyResponse { Success = true }); // assert storageService.Verify(c => c.PersistBlobResult(It.IsAny <HealthyResponse>()), Times.Never); }
public async Task AzureStorageResultPlugin_should_fail_with_out_connection_string(string cs) { // arrange var storageService = new Mock <IStorageService>(); var plugin = new AzureStorageResultPlugin(storageService.Object); HealthCheckAzureStorageConfigurations.Instance.AzureStorageConnectionString = cs; // act // assert await Assert.ThrowsAsync <InvalidOperationException>( async() => await plugin.ActionAfterResult(new HealthyResponse { Success = false })); }