public void TestSingleTripPointInTimeQueryAfterUpdateMessage() { TripMessageBl.InsertTripMessage(new TripMessage { Epoch = 1392864673030, Event = TripEvent.Begin, Latitude = 37, Longitude = 122, TripId = 432 }); TripMessageBl.InsertTripMessage(new TripMessage { Epoch = 1392864673040, Event = TripEvent.Update, Latitude = 39, Longitude = 124, TripId = 432 }); var totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673020); Assert.That(totalTrips, Is.EqualTo(0)); totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673030); Assert.That(totalTrips, Is.EqualTo(1)); totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673040); Assert.That(totalTrips, Is.EqualTo(1)); totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673070); Assert.That(totalTrips, Is.EqualTo(1)); }
private string GetTotalTripsOccuringAtTimeResponseString() { var epoch = GetEpoch(); return (JsonConvert.SerializeObject( new { queryType = QueryType.PointInTime, epoch, numberOfTrips = TripBl.GetTotalTripsOccuringAtTime(epoch) }, SerializerSettings)); }
public void TestMultipleTripPointInTimeQuery() { TripMessageBl.InsertTripMessage(new TripMessage { Epoch = 1392864673030, Event = TripEvent.Begin, Latitude = 30, Longitude = 110, TripId = 432 }); TripMessageBl.InsertTripMessage(new TripMessage { Epoch = 1392864673040, Event = TripEvent.Update, Latitude = 39, Longitude = 124, TripId = 432 }); TripMessageBl.InsertTripMessage(new TripMessage { Epoch = 1392864673070, Event = TripEvent.End, Fare = 25, Latitude = 40, Longitude = 120, TripId = 432 }); TripMessageBl.InsertTripMessage(new TripMessage { Epoch = 1392864673040, Event = TripEvent.Begin, Latitude = 40, Longitude = 120, TripId = 433 }); TripMessageBl.InsertTripMessage(new TripMessage { Epoch = 1392864673070, Event = TripEvent.Update, Latitude = 39, Longitude = 124, TripId = 433 }); TripMessageBl.InsertTripMessage(new TripMessage { Epoch = 1392864673080, Event = TripEvent.End, Fare = 50, Latitude = 50, Longitude = 130, TripId = 433 }); var totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673020); Assert.That(totalTrips, Is.EqualTo(0)); totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673030); Assert.That(totalTrips, Is.EqualTo(1)); totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673040); Assert.That(totalTrips, Is.EqualTo(2)); totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673070); Assert.That(totalTrips, Is.EqualTo(2)); totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673080); Assert.That(totalTrips, Is.EqualTo(1)); totalTrips = TripBl.GetTotalTripsOccuringAtTime(1392864673090); Assert.That(totalTrips, Is.EqualTo(0)); }
private static void GetTripQueryWithInvalidEpoch() { TripBl.GetTotalTripsOccuringAtTime(0); }