WireMock.FluentAssertions doesn't work with FluentAssertions 8.x #680

Closed
opened 2025-12-29 15:30:45 +01:00 by adam · 2 comments
Owner

Originally created by @tlevesque-ueat on GitHub (Mar 27, 2025).

Describe the bug

After upgrading FluentAssertions from 7.2.0 to 8.2.0, IWireMockServer.Should() fails with MissingMethodException:

System.MissingMethodException: Method not found: 'Void FluentAssertions.Primitives.ReferenceTypeAssertions`2..ctor(!0)'.

System.MissingMethodException
Method not found: 'Void FluentAssertions.Primitives.ReferenceTypeAssertions`2..ctor(!0)'.
   at WireMock.FluentAssertions.WireMockReceivedAssertions..ctor(IWireMockServer server)
   at WireMock.FluentAssertions.WireMockExtensions.Should(IWireMockServer instance)

Expected behavior:

Should work as it did with earlier versions of FluentAssertions

Test to reproduce

Run this test

using WireMock.FluentAssertions;
using WireMock.RequestBuilders;
using WireMock.ResponseBuilders;
using WireMock.Server;
using Xunit;

namespace MyNamespace;

public class Test
{
    [Fact]
    public async Task TestWiremockFluentAssertions()
    {
        using var server = WireMockServer.Start();
        using var client = server.CreateClient();
        server.Given(Request.Create().UsingGet())
            .RespondWith(Response.Create().WithStatusCode(200));

        using var response = await client.GetAsync("/foo");
        response.EnsureSuccessStatusCode();

        server.Should().HaveReceived(1).Calls();
    }
}

Using WireMock.Net.FluentAssertions 1.7.4 and FluentAssertions 8.2.0

Originally created by @tlevesque-ueat on GitHub (Mar 27, 2025). ### Describe the bug After upgrading FluentAssertions from 7.2.0 to 8.2.0, `IWireMockServer.Should()` fails with `MissingMethodException`: ``` System.MissingMethodException: Method not found: 'Void FluentAssertions.Primitives.ReferenceTypeAssertions`2..ctor(!0)'. System.MissingMethodException Method not found: 'Void FluentAssertions.Primitives.ReferenceTypeAssertions`2..ctor(!0)'. at WireMock.FluentAssertions.WireMockReceivedAssertions..ctor(IWireMockServer server) at WireMock.FluentAssertions.WireMockExtensions.Should(IWireMockServer instance) ``` ### Expected behavior: Should work as it did with earlier versions of FluentAssertions ### Test to reproduce Run this test ```csharp using WireMock.FluentAssertions; using WireMock.RequestBuilders; using WireMock.ResponseBuilders; using WireMock.Server; using Xunit; namespace MyNamespace; public class Test { [Fact] public async Task TestWiremockFluentAssertions() { using var server = WireMockServer.Start(); using var client = server.CreateClient(); server.Given(Request.Create().UsingGet()) .RespondWith(Response.Create().WithStatusCode(200)); using var response = await client.GetAsync("/foo"); response.EnsureSuccessStatusCode(); server.Should().HaveReceived(1).Calls(); } } ``` ### Other related info Using `WireMock.Net.FluentAssertions` 1.7.4 and `FluentAssertions` 8.2.0
adam added the invalid label 2025-12-29 15:30:45 +01:00
adam closed this issue 2025-12-29 15:30:45 +01:00
Author
Owner

@StefH commented on GitHub (Mar 27, 2025):

I am doubting if I should keep it...

See also this;
https://github.com/orgs/WireMock-Net/discussions/1238

@StefH commented on GitHub (Mar 27, 2025): I am doubting if I should keep it... See also this; https://github.com/orgs/WireMock-Net/discussions/1238
Author
Owner

@tlevesque-ueat commented on GitHub (Mar 27, 2025):

Oh, right, I forgot about this!
Renovate pushed me an update for FA, but given the license changes, I guess I'll stay on 7.x

@tlevesque-ueat commented on GitHub (Mar 27, 2025): Oh, right, I forgot about this! Renovate pushed me an update for FA, but given the license changes, I guess I'll stay on 7.x
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/WireMock.Net-wiremock#680