public void DbGetAllTest() { var options = new DbContextOptionsBuilder <InvitationsDbContext>() .UseInMemoryDatabase(databaseName: "DbGetAllTestsDatabase") .Options; using (var context = new InvitationsDbContext(options)) { context.Invitations.Add(new Invitation { Phone = "79998887766", Author = 4 }); context.Invitations.Add(new Invitation { Phone = "79998887765", Author = 4 }); context.Invitations.Add(new Invitation { Phone = "79998887764", Author = 4 }); context.SaveChanges(); } using (var context = new InvitationsDbContext(options)) { var invitationRepository = new InvitationRepository(context); List <Invitation> list = invitationRepository.GetAll(); Assert.Equal(3, list.Count); } }