-
Notifications
You must be signed in to change notification settings - Fork 25
Open
Description
Braces are laid out incorrectly
ProductDoesNotExist - Expectation incorrect
GetProductMissingAuthHeader - Assertion incorrect
Consumer/tests/ApiTest.cs:
[Fact]
public async void ProductDoesNotExist()
{
// Arange
pact.UponReceiving("A valid request for a product")
.Given("product with ID 11 does not exist")
.WithRequest(HttpMethod.Get, "/api/products/11")
.WithHeader("Authorization", Match.Regex("Bearer 2019-01-14T11:34:18.045Z", "Bearer \\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{3}Z"))
.WillRespond()
.WithStatus(HttpStatusCode.Unauthorized);
//Should be .WithStatus(HttpStatusCode.NotFound);
await pact.VerifyAsync(async ctx => {
var response = await ApiClient.GetProduct(11);
Assert.Equal(HttpStatusCode.NotFound, response.StatusCode);
});
[Fact]
public async void GetProductMissingAuthHeader()
{
// Arange
pact.UponReceiving("A valid request for a product")
.Given("No auth token is provided")
.WithRequest(HttpMethod.Get, "/api/products/10")
.WillRespond()
.WithStatus(HttpStatusCode.Unauthorized);
await pact.VerifyAsync(async ctx => {
var response = await ApiClient.GetProduct(10);
Assert.Equal(HttpStatusCode.Forbidden, response.StatusCode);
//Should be Assert.Equal(HttpStatusCode.Unauthorized, response.StatusCode);
});
}
}
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels