public void ChangeItemTest() { var repo = new MarksRepository(_context); var item = new Mark { Student = _context.Students.FirstOrDefault(), TeachSubj = _context.TeachSubjs.FirstOrDefault(), StudentsMark = 77 }; repo.AddItem(item); int Id = _context.Marks.FirstOrDefault(x => x.Student.Id == item.Student.Id && x.TeachSubj.Id == item.TeachSubj.Id && x.StudentsMark == item.StudentsMark).Id; var newitem = repo.GetItem(Id); newitem.StudentsMark = 83; repo.ChangeItem(newitem); var gotitem = repo.GetItem(Id); Assert.AreEqual(newitem.Student.Id, gotitem.Student.Id); Assert.AreEqual(newitem.StudentsMark, gotitem.StudentsMark); Assert.AreEqual(newitem.TeachSubj.TeacherId, gotitem.TeachSubj.TeacherId); Assert.AreEqual(newitem.TeachSubj.SubjId, gotitem.TeachSubj.SubjId); _context.Marks.Remove(newitem); }