public void PutAppartmentTest() { //Arrange ApartmentService ap = new ApartmentService(); var newApartment = new Apartment { Price = 5000, Location = "KallePotte", PostalCode = 9999, Size = 555, NoRoom = 777, WashingMachine = false, Dishwasher = false }; ap.UpdateApartment("14", newApartment); IList <Apartment> testList = ap.GetAllApartment(); string actuel; string expected = "KallePotte"; //Act&Assert foreach (var appApartment in testList) { if (appApartment.Id == 14) { actuel = appApartment.Location; Assert.AreEqual(expected, actuel); } } }