public void Test_RemoveTripFromModel() { trips.Add(trip1); trips.Add(trip2); TestDbContextTrip t_c_t = new TestDbContextTrip(trips); t_c_t.Trips.Remove(trip1); Assert.AreEqual(null, t_c_t.Trips.Find(1)); }
public void TripDetailsTest() { trips.Add(trip1); trips.Add(trip2); TestDbContextTrip t_c_t = new TestDbContextTrip(trips); t_c_t.Trips.Add(trip1); t_c_t.Trips.Add(trip2); var controller = new TripController(t_c_t); var result = controller.TripDetails(1) as ViewResult; var model = controller.ViewData.Model; Assert.AreEqual(trip1, model); }
public void ShowTripDataTest() { trips.Add(trip1); trips.Add(trip2); TestDbContextTrip t_c_t = new TestDbContextTrip(trips); t_c_t.Trips.Add(trip1); t_c_t.Trips.Add(trip2); SearchBarModel searchBarModel = new SearchBarModel { source = "charlotte", }; var tripController = new TripController(t_c_t); var result = tripController.ShowTripData(searchBarModel) as ViewResult; List <Trip> model = (List <Trip>)tripController.ViewData.Model; Assert.AreEqual(trip2, model[0]); }
public void Test_AddTripToModel() { trips.Add(trip1); trips.Add(trip2); TestDbContextTrip t_c_t = new TestDbContextTrip(trips); Trip t = new Trip { id = 4, source = "charlotte", destination = "DC", created_by = "Bhanu", carAvailable = true, vacant_seats = 2, estimated_cost = 45, description = "xyz" }; t_c_t.Trips.Add(t); Assert.AreEqual(t, t_c_t.Trips.Find(4)); }
public void TripdetailsReturnTest() { TestTripDbset a = new TestTripDbset(); Trip a1 = new Trip { id = 1, source = "durham", destination = "hyderabad", created_by = "bhanu", carAvailable = true, vacant_seats = 4, estimated_cost = 25, description = null }; a.Add(a1); TestDbContextTrip t_c_t = new TestDbContextTrip(a); t_c_t.Trips.Add(a1); var controller = new TripController(t_c_t); var result = controller.TripDetails(1) as ViewResult; Assert.AreEqual("TripDetails", result.ViewName); }
public void ShowJoinButtonTest() { TestTripDbset a = new TestTripDbset(); Trip a1 = new Trip { id = 1, source = "durham", destination = "hyderabad", created_by = "bhanu", carAvailable = true, vacant_seats = 4, estimated_cost = 25, description = null }; a.Add(a1); TestDbContextTrip t_c_t = new TestDbContextTrip(a); t_c_t.Trips.Add(a1); var controller = new TripController(t_c_t); var result = controller.ShowJoinButton("1"); Assert.AreEqual("3", result); }