Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ItemGroup>
<PackageVersion Include="aweXpect" Version="2.30.0" />
<PackageVersion Include="aweXpect.Core" Version="2.27.0" />
<PackageVersion Include="Mockolate" Version="1.4.0" />
<PackageVersion Include="Mockolate" Version="1.4.1" />
</ItemGroup>
<ItemGroup>
<PackageVersion Include="Nullable" Version="1.3.1" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,37 +90,12 @@ public ItExtensions.IHttpContentHeaderParameter WithHeaders(
params IEnumerable<(string Name, HttpHeaderValue Value)> headers)
=> _parameter.WithHeaders(headers);

public ItExtensions.IHttpContentHeaderParameter WithHeaders(string headers)
=> _parameter.WithHeaders(headers);

public ItExtensions.IHttpContentHeaderParameter WithHeaders(string name, HttpHeaderValue value)
=> _parameter.WithHeaders(name, value);

public ItExtensions.IHttpContentParameter WithString(Func<string, bool> predicate)
=> _parameter.WithString(predicate);

public ItExtensions.IStringContentBodyParameter WithString(string expected)
=> _parameter.WithString(expected);

public ItExtensions.IStringContentBodyMatchingParameter WithStringMatching(string pattern)
=> _parameter.WithStringMatching(pattern);

public ItExtensions.IHttpContentParameter WithBytes(byte[] bytes)
=> _parameter.WithBytes(bytes);

public ItExtensions.IHttpContentParameter WithBytes(Func<byte[], bool> predicate)
=> _parameter.WithBytes(predicate);

public ItExtensions.IFormDataContentParameter WithFormData(string key, HttpFormDataValue value)
=> _parameter.WithFormData(key, value);

public ItExtensions.IFormDataContentParameter WithFormData(
params IEnumerable<(string Key, HttpFormDataValue Value)> values)
=> _parameter.WithFormData(values);

public ItExtensions.IFormDataContentParameter WithFormData(string values)
=> _parameter.WithFormData(values);

public ItExtensions.IHttpContentParameter WithMediaType(string? mediaType)
=> _parameter.WithMediaType(mediaType);

Comment thread
vbreuss marked this conversation as resolved.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,22 @@ public async Task ShouldSupportNestedObjects()

await That(result.StatusCode)
.IsEqualTo(HttpStatusCode.OK);
await That(httpClient.VerifyMock.Invoked
.PostAsync(It.IsAny<Uri>(), It.IsHttpContent().WithJsonMatching([
new
{
foo = 2,
},
new
{
foo = 3,
},
new
{
foo = 4,
},
])))
.Once();
}

[Theory]
Expand Down Expand Up @@ -179,6 +195,13 @@ public async Task WithBodyMatching_ShouldCompareAsJson()

await That(result.StatusCode)
.IsEqualTo(HttpStatusCode.OK);
await That(httpClient.VerifyMock.Invoked
.PostAsync(It.IsAny<Uri>(), It.IsHttpContent().WithJsonMatching(new
{
foo = 1,
bar = 2,
})))
.Once();
}

[Theory]
Expand Down Expand Up @@ -250,6 +273,9 @@ public async Task MatchingValues_ShouldSucceed(string[] expected, string body)

await That(result.StatusCode)
.IsEqualTo(HttpStatusCode.OK);
await That(httpClient.VerifyMock.Invoked
.PostAsync(It.IsAny<Uri>(), It.IsHttpContent().WithJsonMatching(expected)))
.Once();
}

[Theory]
Expand Down Expand Up @@ -318,6 +344,9 @@ public async Task WhenSubjectContainsAdditionalElements_ShouldSucceed()

await That(result.StatusCode)
.IsEqualTo(HttpStatusCode.OK);
await That(httpClient.VerifyMock.Invoked
.PostAsync(It.IsAny<Uri>(), It.IsHttpContent().WithJsonMatching([1, 2,])))
.Once();
Comment thread
vbreuss marked this conversation as resolved.
}

[Fact]
Expand Down Expand Up @@ -434,6 +463,9 @@ public async Task WhenExpectedIsEmpty_ShouldSucceed(string body)

await That(result.StatusCode)
.IsEqualTo(HttpStatusCode.OK);
await That(httpClient.VerifyMock.Invoked
.PostAsync(It.IsAny<Uri>(), It.IsHttpContent().WithJsonMatching(new object())))
.Once();
Comment thread
vbreuss marked this conversation as resolved.
}

[Fact]
Expand Down Expand Up @@ -474,6 +506,12 @@ public async Task WhenSubjectHasAdditionalProperties_ShouldSucceed()

await That(result.StatusCode)
.IsEqualTo(HttpStatusCode.OK);
await That(httpClient.VerifyMock.Invoked
.PostAsync(It.IsAny<Uri>(), It.IsHttpContent().WithJsonMatching(new
{
bar = 2,
})))
.Once();
}

[Fact]
Expand Down
Loading