public void DeleteAppartmentTest() { //Arrange ApartmentService ap = new ApartmentService(); string actual; //Act ap.DeleteAparment("20"); IList <Apartment> testList = ap.GetAllApartment(); //Assert foreach (var appApartment in testList) { if (appApartment.Id == 20) { actual = "Denne findes"; } else { actual = "Findes ikke"; } Assert.AreEqual("Findes ikke", actual); } }
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); } } }
public void GetAllApartmentTest() { //Arrange ApartmentService ap = new ApartmentService(); //Act IList <Apartment> aplist = ap.GetAllApartment(); string actual; if (aplist.Count > 0) { actual = "Ja"; } else { actual = "Nej"; } //Assert Assert.AreEqual("Ja", actual); }