public void SaveTest() { var medicineController = new MedicineController("Test2", 5); string name = Guid.NewGuid().ToString(); var componentController = new ComponentController(medicineController.CurrentMedicine, name); componentController.Save(); string name2 = Guid.NewGuid().ToString(); var componentController2 = new ComponentController(medicineController.CurrentMedicine, name2); var result = componentController2.Components.FirstOrDefault(r => r.Name == name); Assert.AreEqual(result.ToString(), componentController.CurrentComponent.ToString()); }