public void Init()
        {
            var albumsDataPath = Path.Combine("Storage", "Data", "albums.json");
            var photoDataPath  = Path.Combine("Storage", "Data", "photos.json");

            _sampleDataReader = new SampleDataReader(albumsDataPath, photoDataPath, new FileContentReader());
            _albumRepository  = new AlbumRepository(_sampleDataReader);
        }
        public async Task Read_All_Data()
        {
            // Arrange
            var albumsDataPath = Path.Combine("Storage", "Data", "albums.json");
            var photoDataPath  = Path.Combine("Storage", "Data", "photos.json");

            _sampleDataReader = new SampleDataReader(albumsDataPath, photoDataPath, new FileContentReader());

            // Act
            var result = await _sampleDataReader.ReadAlbumsAsync();

            // Assert
            Assert.AreEqual(expected: 100, actual: result.Count);

            result.ForEach((album) =>
            {
                Assert.AreEqual(expected: 50, actual: album.Photos.Count);

                album.Photos.ForEach((photo) =>
                {
                    Assert.AreEqual(expected: album.Id, actual: photo.AlbumId);
                });
            });
        }
예제 #3
0
 public AlbumRepository(ISampleDataReader sampleDataReader)
 {
     _sampleDataReader = sampleDataReader;
 }