public void TestGetTickets() { // db is empty using (var context = new ProTickDatabaseContext(dbOptions)) { var dbm = new DatabaseQueryManager(context); var converter = new ResourceDTOConverter(dbm); var controller = new TicketController(context, converter, dbm); var actual = controller.GetTickets().ToList().Count; int expected = 0; Assert.Equal(expected, actual); } // seeding DB using (var context = new ProTickDatabaseContext(dbOptions)) { DbContextSeeder.SeedFull(context); } // db is Test-Ready using (var context = new ProTickDatabaseContext(dbOptions)) { var dbm = new DatabaseQueryManager(context); var converter = new ResourceDTOConverter(dbm); var controller = new TicketController(context, converter, dbm); var actual = controller.GetTickets().ToList(); var expected = DbContextSeeder.GetSeededTicketDTOs( 3, DbContextSeeder.GetSeededStateDTOs(3), DbContextSeeder.GetSeededSubprocessDTOs( 3, DbContextSeeder.GetSeededProcessDTOs(3), DbContextSeeder.GetSeededTeamDTOs(3)) ) .ToList(); Assert.Equal(expected.Count, actual.Count); expected.Should().BeEquivalentTo(actual); } }