Skip to content

Commit

Permalink
Update VtexHealthClientTests.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
guibranco authored Nov 12, 2024
1 parent 3630698 commit bad1cfd
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Tests/VTEX.Tests/Health/VtexHealthClientTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ namespace VTEX.Tests.Health
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using Moq;
using NSubstitute;

Check failure on line 21 in Tests/VTEX.Tests/Health/VtexHealthClientTests.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

The type or namespace name 'NSubstitute' could not be found (are you missing a using directive or an assembly reference?)

Check failure on line 21 in Tests/VTEX.Tests/Health/VtexHealthClientTests.cs

View workflow job for this annotation

GitHub Actions / Deep Source Coverage report

The type or namespace name 'NSubstitute' could not be found (are you missing a using directive or an assembly reference?)
using VTEX.Health;
using Xunit;

Expand All @@ -31,9 +31,9 @@ public class VtexHealthClientTests
/// Asynchronously validates the health status of a platform by retrieving platform statuses from a health client.
/// </summary>
/// <remarks>
/// This test method sets up a mock implementation of the <see cref="IVtexHealthClient"/> interface to simulate the retrieval of platform statuses.
/// This test method sets up a substitute implementation of the <see cref="IVtexHealthClient"/> interface to simulate the retrieval of platform statuses.
/// It creates a collection of <see cref="PlatformStatus"/> objects, representing both healthy and unhealthy statuses.
/// The method then calls the mocked client's <see cref="IVtexHealthClient.GetPlatformStatuesAsync"/> method and verifies that the result is not null.
/// The method then calls the substitute's <see cref="IVtexHealthClient.GetPlatformStatuesAsync"/> method and verifies that the result is not null.
/// It also checks that the returned list contains exactly two items, one with a healthy status and one with an unhealthy status.
/// This ensures that the health client is functioning as expected and returning the correct platform statuses.
/// </remarks>
Expand All @@ -58,13 +58,13 @@ public async Task ValidateHealthClient()
},
};

var clientMock = new Mock<IVtexHealthClient>();
clientMock
.Setup(c => c.GetPlatformStatuesAsync(It.IsAny<CancellationToken>()))
.ReturnsAsync(fixtures);
var clientSubstitute = Substitute.For<IVtexHealthClient>();
clientSubstitute
.GetPlatformStatuesAsync(Arg.Any<CancellationToken>())
.Returns(fixtures);

var result = await clientMock
.Object.GetPlatformStatuesAsync(CancellationToken.None)
var result = await clientSubstitute
.GetPlatformStatuesAsync(CancellationToken.None)
.ConfigureAwait(false);

Assert.NotNull(result);
Expand Down

0 comments on commit bad1cfd

Please sign in to comment.