public void GetTeam_Test() { //Arrange var options = new DbContextOptionsBuilder <TeamContext>().UseInMemoryDatabase($"TeamContext_{ Guid.NewGuid() }").Options; using (var context = new TeamContext(options)) { context.Add(new Team() { Id = 1, City = "Chicago", Name = "Chicago Fire", DateOfFoundation = DateTime.Now }); context.Add(new Team() { Id = 2, City = "Los Angeles", Name = "Los Angeles Galaxy", DateOfFoundation = DateTime.Now }); context.SaveChanges(); var repository = new TeamsRepository(context); //Act var team = repository.GetTeam(1); //Assert Assert.Equal("Chicago", team.City); Assert.Equal("Chicago Fire", team.Name); } }