private async Task WriteOperation_IfBodyContainsOnlySpaces_ShouldThrowPostValidationException(WriteOperationTypes operationType) { var service = CreateTestingService(); var postWithWhiteSpacesBody = new Post(Guid.NewGuid(), " "); switch (operationType) { case WriteOperationTypes.Add: await Assert.ThrowsAsync <PostValidationException>(async() => await service.AddAsync(postWithWhiteSpacesBody)); break; case WriteOperationTypes.Update: await Assert.ThrowsAsync <PostValidationException>(async() => await service.UpdateAsync(postWithWhiteSpacesBody)); break; } }
private async Task WriteOperation_IfIdEmpty_ShouldThrowPostValidationException(WriteOperationTypes operationType) { var service = CreateTestingService(); var postWithEmptyBody = new Post(Guid.Empty, "write post body"); switch (operationType) { case WriteOperationTypes.Add: await Assert.ThrowsAsync <PostValidationException>(async() => await service.AddAsync(postWithEmptyBody)); break; case WriteOperationTypes.Update: await Assert.ThrowsAsync <PostValidationException>(async() => await service.UpdateAsync(postWithEmptyBody)); break; } }