public void Delete() { // Arrange CarAdvertController controller = new CarAdvertController(); controller.DummyAdvertList = TestAdvertList.ToList(); // Act CarAdvertViewModel oldAdvertOne = controller.GetAdvertById(1); CarAdvertViewModel oldAdvertTwo = controller.GetAdvertById(2); controller.DeleteAdvert(1); IEnumerable <CarAdvertViewModel> result = controller.GetAll(); // Assert Assert.AreEqual(5, result.Count()); Assert.AreNotEqual(oldAdvertOne, result.ElementAt(0)); Assert.AreEqual(oldAdvertTwo, result.ElementAt(0)); }
public void GetById() { // Arrange CarAdvertController controller = new CarAdvertController(); controller.DummyAdvertList = TestAdvertList.ToList(); // Act CarAdvertViewModel result = controller.GetAdvertById(5); // Assert Assert.AreEqual(TestAdvertList.ElementAtOrDefault(4), result); }