Skip to content

Still compatible with FA v8? #130

@mu88

Description

@mu88

Hi 👋🏻

As the previously introduced HTTP assertions of v6.4 have been removed in FA v8, I want to migrate to your neat package 🙃

However, using your sample code fails for as the extension method Be200Ok() cannot be found:

// Arrange
var client = _factory.CreateClient();

// Act
var response = await client.GetAsync("/healthz");

// Assert
response.Should().Be200Ok();

Instead, it only compiles like this:

// Arrange
var client = _factory.CreateClient();

// Act
var response = await client.GetAsync("/healthz");

// Assert
new FluentAssertions.Web.HttpResponseMessageAssertions(response).Be200Ok();

However, this fails during test execution:

 Starting test execution, please wait...
A total of 1 test files matched the specified pattern.
  Failed AppRunningInDocker_ShouldBeHealthy [16 s]
  Error Message:
   System.MissingMethodException : Method not found: 'Void FluentAssertions.Primitives.ReferenceTypeAssertions`2..ctor(!0)'.
  Stack Trace:
     at FluentAssertions.Web.HttpResponseMessageAssertions..ctor(HttpResponseMessage value)
   at Tests.SystemTests.SystemTests.HealthCheckShouldBeHealthyAsync(HttpResponseMessage healthCheckResponse, CancellationToken cancellationToken) in /home/runner/work/ShopAndEat/ShopAndEat/Tests/System/SystemTests.cs:line 103
   at Tests.SystemTests.SystemTests.AppRunningInDocker_ShouldBeHealthy() in /home/runner/work/ShopAndEat/ShopAndEat/Tests/System/SystemTests.cs:line 29
   at NUnit.Framework.Internal.TaskAwaitAdapter.GenericAdapter`1.BlockUntilCompleted()
   at NUnit.Framework.Internal.MessagePumpStrategy.NoMessagePumpStrategy.WaitForCompletion(AwaitAdapter awaiter)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await[TResult](TestExecutionContext context, Func`1 invoke)
   at NUnit.Framework.Internal.AsyncToSyncAdapter.Await(TestExecutionContext context, Func`1 invoke)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.RunTestMethod(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.TestMethodCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Commands.BeforeTestCommand.Execute(TestExecutionContext context)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.<>c__DisplayClass3_0.<PerformWork>b__0()
   at NUnit.Framework.Internal.ContextUtils.<>c__DisplayClass1_0`1.<DoIsolated>b__0(Object _)
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
--- End of stack trace from previous location ---
   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated(ContextCallback callback, Object state)
   at NUnit.Framework.Internal.ContextUtils.DoIsolated[T](Func`1 func)
   at NUnit.Framework.Internal.Execution.SimpleWorkItem.PerformWork()

Sorry if it's a dumb question and I'm doing something very basic wrong 🙈

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions