private async Task Delete_Document_UnitTest(string authKey) { Command deleteResponse = new Command(); IdentityDocument getResponse = new IdentityDocument(); try { if (authKey.Equals("")) { deleteResponse = await _bucketService.DeleteAsync(FirstDocumentId, _logger); getResponse = await _bucketService.GetAsync <IdentityDocument>(FirstDocumentId, _logger); } else { var bucketService = new BucketService(authKey); deleteResponse = await bucketService.DeleteAsync(SecondDocumentId, _logger); getResponse = await bucketService.GetAsync <IdentityDocument>(SecondDocumentId, _logger); } } catch (BlipHttpClientException) { getResponse.Value.ShouldBeNull(); } finally { deleteResponse.Status.ShouldBe(CommandStatus.Success); } }
public async Task BucketDeleteLogUnitTest_ShouldSucceed() { var client = BuildSenderSubstitute_ReturnsSuccessStatus(); var bucketService = new BucketService(client); var logger = Substitute.For <ILogger>(); var task = bucketService.DeleteAsync(FirstDocumentId, logger); await TestInfoLogsWithOneArg <string>(task, 2, logger); }
public async Task BucketDeleteLogUnitTest_ShouldThrowEx() { var logger = Substitute.For <ILogger>(); var client = BuildSenderSubstitute_ThrowsException(); var bucketService = new BucketService(client); var exceptionThrown = false; try { await bucketService.DeleteAsync(FirstDocumentId, logger); } catch (Exception ex) { logger.Received(1).Error(ex, Arg.Any <string>(), Arg.Any <string>()); exceptionThrown = true; } finally { exceptionThrown.ShouldBe(true); } }