Ejemplo n.º 1
0
 public void EditTripInDatabaseShouldChangePreviouslyAddedTrip()
 {
     TripController controller = new TripController(repo);
     Trip trip2changed = new Trip() { TripID = 2, DestinationID = 1, StartDate = new DateTime(2013, 12, 1), EndDate = new DateTime(2013, 12, 3) };
     controller.EditTripInDatabase(trip2changed);
     ViewResult result = controller.Trips() as ViewResult;
     Assert.IsNotNull(result);
     IEnumerable<Trip> model = result.Model as IEnumerable<Trip>;
     Assert.AreEqual(2, model.Count());
     Trip temp = model.ElementAt(1);
     Assert.AreEqual(trip2changed.TripID, temp.TripID);
     Assert.AreEqual(trip2changed.DestinationID, temp.DestinationID);
     Assert.AreEqual(trip2changed.StartDate, temp.StartDate);
     Assert.AreEqual(trip2changed.EndDate, temp.EndDate);
 }