Skip to content

Commit

Permalink
Add back test asserting exception
Browse files Browse the repository at this point in the history
  • Loading branch information
JoannaaKL committed Sep 16, 2022
1 parent c5685b7 commit 1778f8f
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/Test/L0/Worker/ContainerOperationProviderL0.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,27 @@ public async void RunServiceContainersHealthcheck_UnhealthyServiceContainer_Asse
await containerOperationProvider.RunContainersHealthcheck(_ec.Object, containers);
}
catch (InvalidOperationException)
{

//Assert
{

//Assert
Assert.Equal(TaskResult.Failed, _ec.Object.Result ?? TaskResult.Failed);
}
}

[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
public async void RunServiceContainersHealthcheck_UnhealthyServiceContainer_AssertExceptionThrown()
{
//Arrange
Setup();
_dockerManager.Setup(x => x.DockerInspect(_ec.Object, It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(unhealthyDockerStatus));

//Act and Assert
await Assert.ThrowsAsync<InvalidOperationException>(() => containerOperationProvider.RunContainersHealthcheck(_ec.Object, containers));

}

[Fact]
[Trait("Level", "L0")]
[Trait("Category", "Worker")]
Expand All @@ -61,7 +74,7 @@ public async void RunServiceContainersHealthcheck_healthyServiceContainer_Assert
_dockerManager.Setup(x => x.DockerInspect(_ec.Object, It.IsAny<string>(), It.IsAny<string>())).Returns(Task.FromResult(healthyDockerStatus));

//Act
await containerOperationProvider.RunContainersHealthcheck(_ec.Object, containers).ConfigureAwait(true);
await containerOperationProvider.RunContainersHealthcheck(_ec.Object, containers);

//Assert
Assert.Equal(TaskResult.Succeeded, _ec.Object.Result ?? TaskResult.Succeeded);
Expand Down

0 comments on commit 1778f8f

Please sign in to comment.