Beispiel #1
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);

                var originalAdd = await _sut.AddAsync(ThirdPartyId);

                _expected.Id = originalAdd.Id;

                _result = await _sut.AddAsync(ThirdPartyId);
            }
            public static async Task ClassIniitalize(TestContext _)
            {
                var logger = new NullLogger <AlbumifyService>();

                myCollection           = new Mock <IMyCollectionRepository>();
                thirdPartyMusicService = new Mock <I3rdPartyMusicService>();

                myCollection.Setup(m => m.FindBy3rdPartyIdAsync(ThirdPartyId)).ReturnsAsync(CollectionAlbum);

                var sut = new AlbumifyService(logger, thirdPartyMusicService.Object, myCollection.Object);

                result = await sut.AddAsync(ThirdPartyId);
            }
            public static async Task ClassInitialize(TestContext _)
            {
                myCollection = new Mock <IMyCollectionRepository>();
                myCollection.Setup(c => c.FindBy3rdPartyIdAsync(It.IsAny <string>())).ReturnsAsync(Album.CreateForUnknown(ThirdPartyId));

                var thirdPartyMusicService = new Mock <I3rdPartyMusicService>();

                thirdPartyMusicService.Setup(s => s.GetAlbumAsync(It.IsAny <string>())).ReturnsAsync(UnknownAlbum);

                var logger = new NullLogger <AlbumifyService>();
                var sut    = new AlbumifyService(logger, thirdPartyMusicService.Object, myCollection.Object);

                result = await sut.AddAsync(ThirdPartyId);
            }
        public async Task <IActionResult> Add(AlbumDetailsViewModel viewModel)
        {
            await _albumifyService.AddAsync(viewModel.ThirdPartyId);

            return(RedirectToAction("Index", "Album", new { id = viewModel.ThirdPartyId }));
        }