public void ChangeItemTest() { var repo = new StudentsRepository(_context); var item = new Student { FirstName = "Kurt", MiddleName = "Unknown", LastName = "Wallander", Address = "Ystad", Birthday = new DateTime(1961, 05, 23), Email = "*****@*****.**", LogbookNumber = 4366, Group = _context.Groups.FirstOrDefault() }; repo.AddItem(item); int Id = _context.Students.FirstOrDefault(x => x.LogbookNumber == item.LogbookNumber).Id; var newitem = repo.GetItem(Id); newitem.Email = "*****@*****.**"; repo.ChangeItem(newitem); var gotitem = repo.GetItem(Id); Assert.AreEqual(newitem.FirstName, gotitem.FirstName); Assert.AreEqual(newitem.MiddleName, gotitem.MiddleName); Assert.AreEqual(newitem.LastName, gotitem.LastName); Assert.AreEqual(newitem.Address, gotitem.Address); Assert.AreEqual(newitem.Birthday, gotitem.Birthday); Assert.AreEqual(newitem.Email, gotitem.Email); Assert.AreEqual(newitem.LogbookNumber, gotitem.LogbookNumber); _context.Students.Remove(newitem); }