public async void DeleteResource_ValidConfigId_NoExceptionThrown() { // Arrange var dependantResourceModel = new DependantResourceModel { ResourceType = ResourceTypeEnum.ResultConfig, ResourceId = "e019f476-b413-4ee7-965b-a4c0389cd086" }; var httpService = new HttpService(new HttpClient()); var resultConfigClient = new ResultConfigClient(httpService); Exception exception = null; try { // Act await resultConfigClient.DeleteResource(dependantResourceModel); } catch (Exception e) { exception = e; } // Assert Assert.Null(exception); }
public async void DeleteResource_InternalServerErrorStatusCode_ThrowsException() { // Arrange var httpService = new Mock <IHttpService>(); var httpResponseMessage = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent("") }; httpService .Setup(m => m.DeleteAsync(It.IsAny <string>())) .ReturnsAsync(httpResponseMessage); var resultConfigClient = new ResultConfigClient( httpService.Object ); Exception exception = null; try { // Act await resultConfigClient.DeleteResource( DependantResourceDataMocks.MockDependantResourceModel() ); } catch (FailedToDeleteResourceException e) { exception = e; } // Assert Assert.NotNull(exception); }