Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DatabaseFixture<T> does not support generic options #91

Open
Keboo opened this issue Sep 15, 2020 · 2 comments
Open

DatabaseFixture<T> does not support generic options #91

Keboo opened this issue Sep 15, 2020 · 2 comments

Comments

@Keboo
Copy link
Member

Keboo commented Sep 15, 2020

Reproduction steps:

Create context with a single constructor that takes in the generic DbContextOptions

public class BudgetContext : DbContext
{
    public BudgetContext(DbContextOptions<BudgetContext> options)
        : base(options)
    { }
}

Attempt to use the DatabaseFixture.

var fixture = new DatabaseFixture<BudgetContext>();

await fixture.PerformDatabaseOperation(async context =>
{
    ...
});

Observed:
System.InvalidOperationException: '***.BudgetContext' must contain a constructor that has a single parameter of type 'Microsoft.EntityFrameworkCore.DbContextOptions'

Expected:
I want my DbContext to take in the generic options overload.

@Keboo
Copy link
Member Author

Keboo commented Sep 15, 2020

@COsborn2 FYI

@COsborn2
Copy link
Contributor

COsborn2 commented Sep 15, 2020

@Keboo Are you on the latest CI build? 0.1.1-ci-9642
I think this will be fixed in 0.1.1 (once it releases). Support for non-generic DbContextOptions was dropped. The above behavior was what was intended.

Just confirming you want behavior like below?
SampleDbContext https://github.com/IntelliTect/TestTools/blob/master/IntelliTect.TestTools.Data.Test/SampleDbContext.cs
Test https://github.com/IntelliTect/TestTools/blob/master/IntelliTect.TestTools.Data.Test/DatabaseFixture.SampleDbContext.Tests.cs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants