public async void UnmarkMetadata_MarkedMetadataModel_NoExceptionThrown() { // Arrange var dependantResourceModel = new DependantResourceModel( ResourceTypeEnum.Metadata, "c9de8a5e-1ab1-431f-a759-f44d7eef4e19" ) { PreviousState = MetadataModel.FinishedState }; var httpService = new HttpService(new HttpClient()); var metadataClient = new MetadataClient( httpService ); Exception exception = null; try { // Act await metadataClient.UnmarkMetadata(dependantResourceModel); } catch (Exception e) { exception = e; } // Assert Assert.Null(exception); }
public async void UnmarkMetadata_InternalServerErrorStatusCode_ThrowsException() { // Arrange var httpResponseMessage = new HttpResponseMessage { StatusCode = HttpStatusCode.InternalServerError, Content = new StringContent("Some error!") }; var httpService = new Mock <IHttpService>(); httpService .Setup(m => m.PutAsync(It.IsAny <string>(), It.IsAny <string>())) .ReturnsAsync(httpResponseMessage); var metadataClient = new MetadataClient(httpService.Object); Exception exception = null; try { // Act await metadataClient.UnmarkMetadata(DependantResourceDataMocks.MockDependantResourceModel()); } catch (FailedToUpdateResourceException e) { exception = e; } // Assert Assert.NotNull(exception); }