示例#1
0
        public async Task GetTrack_TrackId_CorrectTrackName()
        {
            // arrange
            const string trackId = "5lA3pwMkBdd24StM90QrNR";

            var http     = new HttpClient();
            var accounts = new AccountsService(http, TestsHelper.GetLocalConfig());

            var api = new TracksApi(http, accounts);

            // act
            var response = await api.GetTrack(trackId);

            // assert
            Assert.AreEqual("P.Y.T. (Pretty Young Thing)", response.Name);
        }
示例#2
0
        public async Task GetTrack_TrackIdNoMarket_MarketsArrayExists()
        {
            // arrange
            const string trackId = "5lA3pwMkBdd24StM90QrNR";

            var http     = new HttpClient();
            var accounts = new AccountsService(http, TestsHelper.GetLocalConfig());

            var api = new TracksApi(http, accounts);

            // act
            var response = await api.GetTrack(trackId);

            // assert
            Assert.IsTrue(response.AvailableMarkets.Length > 0);
        }
示例#3
0
        public async Task GetTrack_TrackIdMarket_AvailableMarketsIsNull()
        {
            // arrange
            const string trackId = "11dFghVXANMlKmJXsNCbd8";
            const string market  = SpotifyCountryCodes.Spain;

            var http     = new HttpClient();
            var accounts = new AccountsService(http, TestsHelper.GetLocalConfig());

            var api = new TracksApi(http, accounts);

            // act
            var response = await api.GetTrack(trackId, market);

            // assert
            Assert.IsNull(response?.AvailableMarkets?.Length == 0 ? null : "Array not empty.");
        }
        public async Task GetTrack_TrackIdMarket_AvailableMarketsIsNull()
        {
            // arrange
            const string trackId = "5lA3pwMkBdd24StM90QrNR";
            const string market  = SpotifyCountryCodes.New_Zealand;

            var http     = new HttpClient();
            var accounts = new AccountsService(http, TestsHelper.GetLocalConfig());

            var api = new TracksApi(http, accounts);

            // act
            var response = await api.GetTrack(trackId, market);

            // assert
            Assert.IsNull(response.AvailableMarkets);
        }