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