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 Benchmarks/Mockolate.Benchmarks/CallbackBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace Mockolate.Benchmarks;
public class CallbackBenchmarks : BenchmarksBase
{
/// <summary>
/// <see href="https://awexpect.com/Mockolate" />
/// <see href="https://docs.testably.org/Mockolate" />
/// </summary>
[Benchmark(Baseline = true)]
public int Callback_Mockolate()
Expand Down
2 changes: 1 addition & 1 deletion Benchmarks/Mockolate.Benchmarks/CompleteEventBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace Mockolate.Benchmarks;
public class CompleteEventBenchmarks : BenchmarksBase
{
/// <summary>
/// <see href="https://awexpect.com/Mockolate" />
/// <see href="https://docs.testably.org/Mockolate" />
/// </summary>
[Benchmark(Baseline = true)]
public void Event_Mockolate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class CompleteIndexerBenchmarks : BenchmarksBase
[Params(1, 10)] public int N { get; set; }

/// <summary>
/// <see href="https://awexpect.com/Mockolate" />
/// <see href="https://docs.testably.org/Mockolate" />
/// </summary>
[Benchmark(Baseline = true)]
public void Indexer_Mockolate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class CompleteMethodBenchmarks : BenchmarksBase
[Params(1, 10)] public int N { get; set; }

/// <summary>
/// <see href="https://awexpect.com/Mockolate" />
/// <see href="https://docs.testably.org/Mockolate" />
/// </summary>
[Benchmark(Baseline = true)]
public void Method_Mockolate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public class CompletePropertyBenchmarks : BenchmarksBase
[Params(1, 10)] public int N { get; set; }

/// <summary>
/// <see href="https://awexpect.com/Mockolate" />
/// <see href="https://docs.testably.org/Mockolate" />
/// </summary>
[Benchmark(Baseline = true)]
public void Property_Mockolate()
Expand Down
2 changes: 1 addition & 1 deletion Docs/pages/04-verify-interactions.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ In both cases, it will block the test execution until the expected interaction o
If the interaction does not occur within the specified time, a `MockVerificationException` will be thrown.

If you need truly asynchronous verification without blocking the test thread, you can use the
[aweXpect.Mockolate](https://awexpect.com/aweXpect.Mockolate) extension package which has an asynchronous `Within(TimeSpan)` variant.
[aweXpect.Mockolate](https://docs.testably.org/extensions/aweXpect.Mockolate) extension package which has an asynchronous `Within(TimeSpan)` variant.

## Properties

Expand Down
2 changes: 1 addition & 1 deletion Docs/pages/setup/01-properties.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,4 @@ sut.Mock.Setup.TotalDispensed.OnGet
- Use `.SkippingBaseClass(…)` to override the base class behavior for a specific property (only for class mocks).
- All callbacks and return values support more advanced features like conditional execution, frequency control,
parallel execution, and access to the invocation counter.
See [Advanced callback features](https://awexpect.com/docs/mockolate/advanced-features/advanced-callback-features) for details.
See [Advanced callback features](../advanced-features/advanced-callback-features) for details.
2 changes: 1 addition & 1 deletion Docs/pages/setup/02-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ sut.Mock.Setup.Dispense(It.Is("White"), It.IsAny<int>())
- When you specify overlapping setups, the most recently defined setup takes precedence.
- All callbacks and return values support more advanced features like conditional execution, frequency control,
parallel execution, and access to the invocation counter.
See [Advanced callback features](https://awexpect.com/docs/mockolate/advanced-features/advanced-callback-features) for details.
See [Advanced callback features](../advanced-features/advanced-callback-features) for details.
6 changes: 3 additions & 3 deletions Docs/pages/setup/03-indexers.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,10 +77,10 @@ sut.Mock.Setup[It.IsAny<string>()].OnGet

- All callbacks support more advanced features like conditional execution, frequency control, parallel execution, and
access to the invocation counter.
See [Advanced callback features](https://awexpect.com/docs/mockolate/advanced-features/advanced-callback-features) for
See [Advanced callback features](../advanced-features/advanced-callback-features) for
details.
- You can use the same [parameter matching](https://awexpect.com/docs/mockolate/setup/parameter-matching)
and [interaction](https://awexpect.com/docs/mockolate/setup/parameter-matching#parameter-interaction) options as for
- You can use the same [parameter matching](parameter-matching)
and [interaction](parameter-matching#parameter-interaction) options as for
methods.
- Use `.SkippingBaseClass(…)` to override the base class behavior for a specific indexer (only for class mocks).
- When you specify overlapping setups, the most recently defined setup takes precedence.
10 changes: 5 additions & 5 deletions Docs/pages/special-types/01-httpclient.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ httpClient.Mock.Setup
It.IsHttpContent())
.ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK));

HttpResponseMessage result = await httpClient.PostAsync("https://aweXpect.com/api/chocolate/dispense",
HttpResponseMessage result = await httpClient.PostAsync("https://testably.org/api/chocolate/dispense",
new StringContent("""
{ "type": "Dark", "amount": 3 }
""", Encoding.UTF8, "application/json"));

await That(result.IsSuccessStatusCode).IsTrue();
httpClient.Mock.Verify.PostAsync(
It.IsUri("*aweXpect.com/api/chocolate/dispense*").ForHttps(),
It.IsUri("*testably.org/api/chocolate/dispense*").ForHttps(),
It.IsHttpContent("application/json").WithStringMatching("*\"type\": \"Dark\"*\"amount\": 3*")).Once();
```

Expand Down Expand Up @@ -86,12 +86,12 @@ Filter requests by URI scheme using `.ForHttps()` or `.ForHttp()`:
```csharp
// Match only HTTPS requests
httpClient.Mock.Verify
.GetAsync(It.IsUri("*aweXpect.com*").ForHttps())
.GetAsync(It.IsUri("*testably.org*").ForHttps())
.Once();

// Match only HTTP requests
httpClient.Mock.Verify
.GetAsync(It.IsUri("*aweXpect.com*").ForHttp())
.GetAsync(It.IsUri("*testably.org*").ForHttp())
.Never();
```

Expand All @@ -101,7 +101,7 @@ Filter requests by host using `.WithHost(string)`. You can provide a wildcard pa

```csharp
httpClient.Mock.Verify
.GetAsync(It.IsUri().WithHost("*aweXpect.com*"))
.GetAsync(It.IsUri().WithHost("*testably.org*"))
.Once();
```

Expand Down
4 changes: 2 additions & 2 deletions Docs/pages/special-types/02-delegates.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ processor.Mock.Setup(It.IsAny<int>(), It.IsRef<int>(v => v + 1), It.IsOut(() =>
- Use `.Returns(…)` to specify the return value for `Func<T>` delegates.
- Use `.Throws(…)` to specify an exception to throw.
- Use `.Returns(…)` and `.Throws(…)` repeatedly to define a sequence of behaviors.
- Full [parameter matching](https://awexpect.com/docs/mockolate/setup#parameter-matching) support for delegate
- Full [parameter matching](../setup/parameter-matching) support for delegate
parameters including `ref` and `out` parameters.

## Verification
Expand Down Expand Up @@ -89,4 +89,4 @@ processor.Mock.Verify(It.IsAny<int>(), It.IsRef<int>(), It.IsOut<int>()).Once();

**Note:**
Delegate parameters also
support [argument matchers](https://awexpect.com/docs/mockolate/verify-interactions#argument-matchers).
support [argument matchers](../verify-interactions#argument-matchers).
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ It enables fast, compile-time validated mocking with .NET Standard 2.0, .NET 8,
| Hot path | dynamic-proxy dispatch | direct dispatch |

For side-by-side setup, usage, and verification syntax against Moq, NSubstitute, and FakeItEasy, see the
[full code comparison](https://awexpect.com/docs/mockolate/comparison).
[full code comparison](https://docs.testably.org/mockolate/comparison).

Already on Moq or NSubstitute? The companion package [`Mockolate.Migration`](https://github.com/Testably/Mockolate.Migration)
ships analyzers and code fixers that translate common Moq and NSubstitute patterns to Mockolate syntax in-place: point it
Expand Down Expand Up @@ -800,8 +800,8 @@ In both cases, it will block the test execution until the expected interaction o
If the interaction does not occur within the specified time, a `MockVerificationException` will be thrown.

If you need truly asynchronous verification without blocking the test thread, you can use the
[aweXpect.Mockolate](https://awexpect.com/aweXpect.Mockolate) NuGet package, which integrates Mockolate's verification
API with [aweXpect](https://awexpect.com) and offers an awaitable `Within(TimeSpan)` variant.
[aweXpect.Mockolate](https://docs.testably.org/extensions/aweXpect.Mockolate/) NuGet package, which integrates Mockolate's verification
API with [aweXpect](https://docs.testably.org/aweXpect) and offers an awaitable `Within(TimeSpan)` variant.

### Properties

Expand Down Expand Up @@ -1258,14 +1258,14 @@ httpClient.Mock.Setup
It.IsHttpContent())
.ReturnsAsync(new HttpResponseMessage(HttpStatusCode.OK));

HttpResponseMessage result = await httpClient.PostAsync("https://aweXpect.com/api/chocolate/dispense",
HttpResponseMessage result = await httpClient.PostAsync("https://testably.org/api/chocolate/dispense",
new StringContent("""
{ "type": "Dark", "amount": 3 }
""", Encoding.UTF8, "application/json"));

await That(result.IsSuccessStatusCode).IsTrue();
httpClient.Mock.Verify.PostAsync(
It.IsUri("*aweXpect.com/api/chocolate/dispense*").ForHttps(),
It.IsUri("*testably.org/api/chocolate/dispense*").ForHttps(),
It.IsHttpContent("application/json").WithStringMatching("*\"type\": \"Dark\"*\"amount\": 3*")).Once();
```

Expand Down Expand Up @@ -1331,12 +1331,12 @@ Filter requests by URI scheme using `.ForHttps()` or `.ForHttp()`:
```csharp
// Match only HTTPS requests
httpClient.Mock.Verify
.GetAsync(It.IsUri("*aweXpect.com*").ForHttps())
.GetAsync(It.IsUri("*testably.org*").ForHttps())
.Once();

// Match only HTTP requests
httpClient.Mock.Verify
.GetAsync(It.IsUri("*aweXpect.com*").ForHttp())
.GetAsync(It.IsUri("*testably.org*").ForHttp())
.Never();
```

Expand All @@ -1346,7 +1346,7 @@ Filter requests by host using `.WithHost(string)`. You can provide a wildcard pa

```csharp
httpClient.Mock.Verify
.GetAsync(It.IsUri().WithHost("*aweXpect.com*"))
.GetAsync(It.IsUri().WithHost("*testably.org*"))
.Once();
```

Expand Down
1 change: 1 addition & 0 deletions Source/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
<Copyright>Copyright (c) 2025 - $([System.DateTime]::Now.ToString('yyyy')) Valentin Breuß</Copyright>
<RepositoryUrl>https://github.com/Testably/Mockolate.git</RepositoryUrl>
<RepositoryType>git</RepositoryType>
<PackageProjectUrl>https://docs.testably.org/Mockolate</PackageProjectUrl>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
<PackageIcon>Docs/logo.png</PackageIcon>
<PackageReadmeFile>Docs/README.md</PackageReadmeFile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public async Task WithStatusCode_ShouldReturnHttpResponseMessageWithStatusCode(H
.GetAsync(It.IsAny<Uri>())
.ReturnsAsync(statusCode);

HttpResponseMessage result = await httpClient.GetAsync("https://www.aweXpect.com", CancellationToken.None);
HttpResponseMessage result = await httpClient.GetAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode).IsEqualTo(statusCode);
#if NET8_0_OR_GREATER
Expand All @@ -43,7 +43,7 @@ public async Task WithStatusCodeAndBytes_ShouldReturnHttpResponseMessageWithStat
.GetAsync(It.IsAny<Uri>())
.ReturnsAsync(statusCode, bytes);

HttpResponseMessage result = await httpClient.GetAsync("https://www.aweXpect.com", CancellationToken.None);
HttpResponseMessage result = await httpClient.GetAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode).IsEqualTo(statusCode);
await That(result.Content).Is<ByteArrayContent>();
Expand All @@ -65,7 +65,7 @@ public async Task
.GetAsync(It.IsAny<Uri>())
.ReturnsAsync(statusCode, content);

HttpResponseMessage result = await httpClient.GetAsync("https://www.aweXpect.com", CancellationToken.None);
HttpResponseMessage result = await httpClient.GetAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode).IsEqualTo(statusCode);
await That(result.Content).Is<ByteArrayContent>();
Expand All @@ -84,7 +84,7 @@ public async Task WithStatusCodeAndString_ShouldReturnHttpResponseMessageWithSta
.GetAsync(It.IsAny<Uri>())
.ReturnsAsync(statusCode, content);

HttpResponseMessage result = await httpClient.GetAsync("https://www.aweXpect.com", CancellationToken.None);
HttpResponseMessage result = await httpClient.GetAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode).IsEqualTo(statusCode);
await That(result.Content).Is<StringContent>();
Expand All @@ -105,7 +105,7 @@ public async Task
.GetAsync(It.IsAny<Uri>())
.ReturnsAsync(statusCode, bytes, mediaType);

HttpResponseMessage result = await httpClient.GetAsync("https://www.aweXpect.com", CancellationToken.None);
HttpResponseMessage result = await httpClient.GetAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode).IsEqualTo(statusCode);
await That(result.Content).Is<ByteArrayContent>();
Expand All @@ -125,7 +125,7 @@ public async Task
.GetAsync(It.IsAny<Uri>())
.ReturnsAsync(statusCode, content, mediaType);

HttpResponseMessage result = await httpClient.GetAsync("https://www.aweXpect.com", CancellationToken.None);
HttpResponseMessage result = await httpClient.GetAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode).IsEqualTo(statusCode);
await That(result.Content).Is<StringContent>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,21 +21,21 @@ public async Task StringUri_ShouldVerifyHttpMethod(string method, bool expectSuc
{
HttpClient httpClient = HttpClient.CreateMock();
httpClient.Mock.Setup
.DeleteAsync(It.Matches("*aweXpect.com*"))
.DeleteAsync(It.Matches("*testably.org*"))
.ReturnsAsync(HttpStatusCode.OK);

HttpResponseMessage result = await httpClient.SendAsync(
new HttpRequestMessage(new HttpMethod(method), "https://www.aweXpect.com"),
new HttpRequestMessage(new HttpMethod(method), "https://www.testably.org"),
CancellationToken.None);

await That(result.StatusCode)
.IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented);
}

[Theory]
[InlineData("*aweXpect.com*", true)]
[InlineData("*aweXpect.com", true)]
[InlineData("aweXpect.com*", false)]
[InlineData("*testably.org*", true)]
[InlineData("*testably.org", true)]
[InlineData("testably.org*", false)]
[InlineData("*foo*", false)]
public async Task StringUri_ShouldVerifyUriString(string pattern, bool expectSuccess)
{
Expand All @@ -45,7 +45,7 @@ public async Task StringUri_ShouldVerifyUriString(string pattern, bool expectSuc
.ReturnsAsync(HttpStatusCode.OK);

HttpResponseMessage result =
await httpClient.DeleteAsync("https://www.aweXpect.com", CancellationToken.None);
await httpClient.DeleteAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode)
.IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented);
Expand All @@ -59,12 +59,12 @@ public async Task StringUri_WithCancellationToken_ShouldVerifyCancellationToken(
HttpClient httpClient = HttpClient.CreateMock();
httpClient.Mock.Setup
.DeleteAsync(
It.Matches("*aweXpect.com*"),
It.Matches("*testably.org*"),
It.Satisfies<CancellationToken>(_ => tokenMatches))
.ReturnsAsync(HttpStatusCode.OK);

HttpResponseMessage result =
await httpClient.DeleteAsync("https://www.aweXpect.com", CancellationToken.None);
await httpClient.DeleteAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode)
.IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented);
Expand All @@ -78,7 +78,7 @@ public async Task StringUri_WithoutMockedHttpMessageHandler_ShouldThrowMockExcep
void Act()
{
httpClient.Mock.Setup
.DeleteAsync(It.Matches("*aweXpect.com*"))
.DeleteAsync(It.Matches("*testably.org*"))
.ReturnsAsync(HttpStatusCode.OK);
}

Expand All @@ -96,21 +96,21 @@ public async Task Uri_ShouldVerifyHttpMethod(string method, bool expectSuccess)
{
HttpClient httpClient = HttpClient.CreateMock();
httpClient.Mock.Setup
.DeleteAsync(It.IsUri("*aweXpect.com*"))
.DeleteAsync(It.IsUri("*testably.org*"))
.ReturnsAsync(HttpStatusCode.OK);

HttpResponseMessage result = await httpClient.SendAsync(
new HttpRequestMessage(new HttpMethod(method), "https://www.aweXpect.com"),
new HttpRequestMessage(new HttpMethod(method), "https://www.testably.org"),
CancellationToken.None);

await That(result.StatusCode)
.IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented);
}

[Theory]
[InlineData("*aweXpect.com*", true)]
[InlineData("*aweXpect.com", true)]
[InlineData("aweXpect.com*", true)]
[InlineData("*testably.org*", true)]
[InlineData("*testably.org", true)]
[InlineData("testably.org*", true)]
[InlineData("*foo*", false)]
public async Task Uri_ShouldVerifyUri(string pattern, bool expectSuccess)
{
Expand All @@ -120,7 +120,7 @@ public async Task Uri_ShouldVerifyUri(string pattern, bool expectSuccess)
.ReturnsAsync(HttpStatusCode.OK);

HttpResponseMessage result =
await httpClient.DeleteAsync("https://www.aweXpect.com", CancellationToken.None);
await httpClient.DeleteAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode)
.IsEqualTo(expectSuccess ? HttpStatusCode.OK : HttpStatusCode.NotImplemented);
Expand All @@ -134,12 +134,12 @@ public async Task Uri_WithCancellationToken_ShouldVerifyCancellationToken(bool t
HttpClient httpClient = HttpClient.CreateMock();
httpClient.Mock.Setup
.DeleteAsync(
It.IsUri("*aweXpect.com*"),
It.IsUri("*testably.org*"),
It.Satisfies<CancellationToken>(_ => tokenMatches))
.ReturnsAsync(HttpStatusCode.OK);

HttpResponseMessage result =
await httpClient.DeleteAsync("https://www.aweXpect.com", CancellationToken.None);
await httpClient.DeleteAsync("https://www.testably.org", CancellationToken.None);

await That(result.StatusCode)
.IsEqualTo(tokenMatches ? HttpStatusCode.OK : HttpStatusCode.NotImplemented);
Expand All @@ -153,7 +153,7 @@ public async Task Uri_WithoutMockedHttpMessageHandler_ShouldThrowMockException()
void Act()
{
httpClient.Mock.Setup
.DeleteAsync(It.IsUri("*aweXpect.com*"))
.DeleteAsync(It.IsUri("*testably.org*"))
.ReturnsAsync(HttpStatusCode.OK);
}

Expand Down
Loading
Loading