Esempio n. 1
0
        public async Task PlayContext_SpotifyUri_SpotifyApiErrorException()
        {
            // arrange
            const string userHash   = "E11AC28538A7C0A827A726DD9B30B710FC1FCAFFFE2E86FCA853AB90E7C710D2";
            const string spotifyUri = "spotify:user:palsvensson:playlist:2iL5fr6OmN8f4yoQvvuWSf";

            var http   = new HttpClient();
            var config = TestsHelper.GetLocalConfig();

            var accounts = new UserAccountsService(http, config, new MockRefreshTokenStore(userHash).Object, null);
            var api      = new PlayerApi(http, accounts);

            // act
            //try
            //{
            await api.PlayContext(userHash, spotifyUri);

            //}
            //catch (SpotifyApiErrorException ex)
            //{
            //Trace.WriteLine(ex.Message);

            //}

            // assert
        }
        //TODO: Something is up - the first error is not being thrown to the test runner...
        //[TestMethod]
        public async Task TwoCompetingUserAccessTokenRequestsGetConsistentResults()
        {
            const string userHash   = "E11AC28538A7C0A827A726DD9B30B710FC1FCAFFFE2E86FCA853AB90E7C710D2";
            const string spotifyUri = "spotify:user:palsvensson:playlist:2iL5fr6OmN8f4yoQvvuWSf";

            var store = new MockRefreshTokenStore(userHash).Object;

            var http1     = new HttpClient();
            var accounts1 = new UserAccountsService(http1, TestsHelper.GetLocalConfig(), store);
            var player1   = new PlayerApi(http1, accounts1);

            var http2     = new HttpClient();
            var accounts2 = new UserAccountsService(http2, TestsHelper.GetLocalConfig(), store);
            var player2   = new PlayerApi(http2, accounts2);

            // act
            //try
            //{
            //TODO: Call Device method instead
            await player1.PlayContext(userHash, spotifyUri);

            //}
            //catch (SpotifyApiErrorException ex)
            //{
            //Trace.WriteLine(ex.Message);
            //}

            //try
            //{
            await player2.PlayContext(userHash, spotifyUri);

            //}
            //catch (SpotifyApiErrorException ex)
            //{
            //  Trace.WriteLine(ex.Message);
            //}

            // assert
            // no error
        }
Esempio n. 3
0
 // only used for manual debugging
 public async Task ControllerAuthorize3()
 {
     // AuthService provides access token to APIs, refreshes when necessary, updates userAuth record
     var player = new PlayerApi(new HttpClient(), _accounts);
     await player.PlayContext("", "");
 }