示例#1
0
        public void TripStoreTests_GetTrips_OK()
        {
            string baseDirectory = $@"{_testsOut}\Trips\";

            Directory.CreateDirectory(baseDirectory);

            var trips = _tripStore.GetTrips();

            foreach (var trip in trips)
            {
                string fpath = baseDirectory + $"{trip.Id}-"
                               + ValidFilename(trip.GetDisplayName(withDate: true)) + ".txt";

                using (var writer = new StreamWriter(File.Open(fpath, FileMode.Create, FileAccess.Write)))
                {
                    writer.WriteLine(trip.Serialize(pretty: true));

                    var photos = _photoStore.GetPhotosByTrip(trip.Id);

                    writer.WriteLine($"Total of {photos.Count} photos for this trip.");

                    foreach (var photo in photos)
                    {
                        if (photo == photos.First())
                        {
                            OutputPhoto(fpath, photo, 1);
                        }
                        else
                        if (photo == photos.LastOrDefault())
                        {
                            OutputPhoto(fpath, photo, photos.Count());
                        }
                    }
                }
            }
        }
示例#2
0
 private void UpdateCounters()
 {
     NumTrips     = _tripStore.GetTrips().Count;
     NumLocations = _locationService.GetLocations().Count();
     NumPlaces    = _tripStore.GetPlacesCount();
 }