public static async Task ClassInitialize(TestContext _)
        {
            _sut = new MyCollectionInMongoDB(new TestingConfiguration().Build());
            await _sut.AddAsync(album1);

            await _sut.AddAsync(album2);

            await _sut.AddAsync(album3);

            await _sut.AddAsync(album4);

            await _sut.AddAsync(album5);
        }
Exemple #2
0
            public static async Task ClassInitialize(TestContext _)
            {
                var logger = new NullLogger <AlbumifyService>();
                var config = new TestingConfiguration().Build();
                var spotifyMusicService = new SpotifyWebApi(new HttpClient(), new SpotifyClientCredentialsFlow(config, new HttpClient()));

                _myCollectionInMongoDB = new MyCollectionInMongoDB(config);
                _sut = new AlbumifyService(logger, spotifyMusicService, _myCollectionInMongoDB);

                _result = await _sut.AddAsync(ThirdPartyId);

                _expected.Id = _result.Id;
            }
            private static async Task <Exception> TryToAddAlbum(IConfiguration config)
            {
                Exception thrownEx = null;

                try
                {
                    var sut = new MyCollectionInMongoDB(config);
                    await sut.AddAsync(new Album());
                }
                catch (Exception ex)
                {
                    thrownEx = ex;
                }

                Assert.IsNotNull(thrownEx);
                Assert.IsInstanceOfType(thrownEx, typeof(AlbumRepositoryException));
                return(thrownEx);
            }
 public static async Task ClassInitialize(TestContext _)
 {
     _sut           = new MyCollectionInMongoDB(new TestingConfiguration().Build());
     _returnedAlbum = await _sut.AddAsync(album);
 }