示例#1
0
            public async Task WithAnInvalidClientSecret()
            {
                var config   = new TestingConfiguration().WithWrongSpotifyClientSecret().Build();
                var thrownEx = await TryToAuthenticate(config);

                Assert.AreEqual("Failed to authenticate with Spotify using Client Credentials Flow: Invalid client secret. " +
                                "Please verify the configuration for SpotifyClientId and SpotifyClientSecret",
                                thrownEx.Message);
            }
示例#2
0
            public async Task WithValidCredentials()
            {
                var config = new TestingConfiguration().Build();
                var sut    = new SpotifyClientCredentialsFlow(config, new HttpClient());
                var result = await sut.RequestAsync();

                Assert.AreEqual(3600, result.ExpiresIn);
                Assert.AreEqual("Bearer", result.TokenType);
                Assert.IsFalse(string.IsNullOrWhiteSpace(result.AccessToken));
            }
示例#3
0
        public static void ClassInitialize(TestContext _)
        {
            var config = new TestingConfiguration().Build();

            sut = new SpotifyWebApi(new HttpClient(), new SpotifyClientCredentialsFlow(config, new HttpClient()));
        }