private static Mock<IDatabase> CreateDatabaseMock() { var database = new Mock<IDatabase>(); var tasks = new InMemoryDbSet<TaskItem>(); tasks.SetPrimaryKeyField(x => x.Id); database.SetupGet(x => x.TaskItems).Returns(tasks); var users = new InMemoryDbSet<User>(); users.SetPrimaryKeyField(x => x.Id); database.SetupGet(x => x.Users).Returns(users); return database; }