Skip to content

MVC functional tests with a fixture pattern for a MySql database on EF Core

Notifications You must be signed in to change notification settings

s0AHC/xunit-fixture-mvc-mysql

 
 

Repository files navigation

Build status NuGet

xunit-fixture-mvc-mysql

MVC functional tests with a fixture pattern built on top of xunit-fixture-mvc and extended for a MySql database on EF Core.

For example:

[Fact]
public Task When_creating_breakfast_item() =>
    new MvcFunctionalTestFixture<Startup>(_output)
        .HavingMySqlDatabase<BreakfastContext>()
        .WhenCreating("BreakfastItem", out CreateOrUpdateBreakfastItemRequest request)
        .ShouldReturnSuccessfulStatus()
        .JsonResultShould<BreakfastItem>(r => r.Id.Should().Be(1),
                                         r => r.Name.Should().Be(request.Name),
                                         r => r.Rating.Should().Be(request.Rating))
        .ShouldExistInDatabase<BreakfastContext, BreakfastItem>(1,
                                        x => x.Id.Should().Be(1),
                                        x => existing.Name.Should().Be(request.Name),
                                        x => x.Rating.Should().Be(request.Rating))
        .RunAsync();

About

MVC functional tests with a fixture pattern for a MySql database on EF Core

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 100.0%