Skip to content

Add ability to ensure ef core context interface and implementation match #50

Open
@fb-smit

Description

@fb-smit

We should add a method in the testing project which enables to check if the interface is missing any public DbSet<> from the acutal context class.

Check could look something like this

var interfacesSets = typeof(IMyDBContext).GetProperties().Select(x => x.Name);
var implementationSets = typeof(MyDBContext)
    .GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public)
    .Select(x => x.Name);
string.Join(' ', implementationSets.Except(interfacesSets)).Should().BeEmpty();

The assert statement also has the benefit of showing the actual missing DbSet<> names, so one can add them easily

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions