Exemplo n.º 1
0
        public void TestCreateGetItineraryStopsByItineraryIdQuery_ItineraryDoesNotExist()
        {
            var project = new Project
            {
                ProjectId = 1,
            };
            var cityLocationType = new LocationType
            {
                LocationTypeId   = LocationType.City.Id,
                LocationTypeName = LocationType.City.Value
            };
            var location = new Location
            {
                LocationId     = 1,
                LocationName   = "city",
                LocationType   = cityLocationType,
                LocationTypeId = cityLocationType.LocationTypeId
            };
            var person1 = new Person
            {
                PersonId = 1,
                FullName = "person 1"
            };
            var participant1 = new Participant
            {
                ParticipantId = 1,
                PersonId      = person1.PersonId,
                Person        = person1
            };
            var itinerary = new Itinerary
            {
                ItineraryId = 1,
                Name        = "itinerary name",
                StartDate   = DateTimeOffset.UtcNow.AddDays(-100.0),
                EndDate     = DateTimeOffset.UtcNow.AddDays(100.0),
                ProjectId   = project.ProjectId,
                Project     = project
            };
            var stop = new ItineraryStop
            {
                DateArrive    = DateTimeOffset.UtcNow.AddDays(-10.0),
                DateLeave     = DateTimeOffset.UtcNow.AddDays(10.0),
                Destination   = location,
                DestinationId = location.LocationId,
                Itinerary     = itinerary,
                ItineraryId   = itinerary.ItineraryId,
                Name          = "stop"
            };

            stop.History.RevisedOn = DateTimeOffset.UtcNow;
            stop.Participants.Add(participant1);

            context.ItineraryStops.Add(stop);
            context.Locations.Add(location);
            context.LocationTypes.Add(cityLocationType);
            var results = ItineraryStopQueries.CreateGetItineraryStopsByItineraryIdQuery(context, itinerary.ItineraryId + 1).ToList();

            Assert.AreEqual(0, results.Count);
        }
 private IQueryable <ItineraryStopDTO> CreateGetItineraryStopsByItineraryIdAndProjectIdQuery(int projectId, int itineraryId)
 {
     return(ItineraryStopQueries.CreateGetItineraryStopsByItineraryIdQuery(this.Context, itineraryId).Where(x => x.ProjectId == projectId).OrderBy(x => x.ArrivalDate));
 }