public async Task ShouldStartNewPlaybackForDeviceFromUrisWithAllParams()
        {
            // Arrange
            const string deviceId = "device1";
            var          positon  = TimeSpan.FromSeconds(10);
            var          uris     = new[] { SpotifyUri.OfAlbum("6akEvsycLGftJxYudPjmqK"), SpotifyUri.OfEpisode("512ojhOuo1ktJprKbVcKyQ") };
            var          offset   = uris[1];

            this.MockHttp
            .ExpectSpotifyRequest(HttpMethod.Put, $"me/player/play")
            .WithExactQueryString(new Dictionary <string, string> {
                ["device_id"] = deviceId
            })
            .WithJsonContent(j =>
                             j.EnumerateObject().Count() == 3 &&
                             j.TryGetProperty("uris", out var array) && array.EnumerateArray().ToArray().Select(x => x.GetString()).SequenceEqual(uris) &&
                             j.TryGetProperty("offset", out var offsetProperty) && offsetProperty.EnumerateObject().Count() == 1 &&
                             offsetProperty.TryGetProperty("uri", out var uriProperty) && uriProperty.GetString() == offset &&
                             j.TryGetProperty("position_ms", out var positionMs) && positionMs.GetInt32() == 10000)
            .Respond(HttpStatusCode.OK, "application/json", "{}");

            // Act
            await this.Client.Me.Player.Playback(deviceId).StartNewAsync(uris, offset, positon);

            // Assert
            this.MockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task ShouldStartNewPlaybackForDeviceFromContextUriWithAllParams()
        {
            // Arrange
            const string deviceId = "device1";
            const int    offset   = 33;
            var          positon  = TimeSpan.FromSeconds(10);
            var          uri      = SpotifyUri.OfAlbum("6akEvsycLGftJxYudPjmqK");

            this.MockHttp
            .ExpectSpotifyRequest(HttpMethod.Put, $"me/player/play")
            .WithExactQueryString(new Dictionary <string, string> {
                ["device_id"] = deviceId
            })
            .WithJsonContent(j =>
                             j.EnumerateObject().Count() == 3 &&
                             j.TryGetProperty("context_uri", out var contextUri) && contextUri.GetString() == uri &&
                             j.TryGetProperty("offset", out var offsetProperty) && offsetProperty.EnumerateObject().Count() == 1 &&
                             offsetProperty.TryGetProperty("position", out var positionProperty) && positionProperty.GetInt32() == offset &&
                             j.TryGetProperty("position_ms", out var positionMs) && positionMs.GetInt32() == 10000)
            .Respond(HttpStatusCode.OK);

            // Act
            await this.Client.Me.Player.Playback(deviceId).StartNewAsync(uri, offset, positon);

            // Assert
            this.MockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task ShouldAddItemToPlaybackQueueForActiveDevice()
        {
            // Arrange
            var uri = SpotifyUri.OfAlbum("6akEvsycLGftJxYudPjmqK");

            this.MockHttp
            .ExpectSpotifyRequest(HttpMethod.Post, $"me/player/queue")
            .WithExactQueryString(new Dictionary <string, string> {
                ["uri"] = uri
            })
            .WithNullContent()
            .Respond(HttpStatusCode.OK);

            // Act
            await this.Client.Me.Player.Playback().Queue.AddAsync(uri);

            // Assert
            this.MockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task ShouldStartNewPlaybackForActiveDeviceFromUris()
        {
            // Arrange
            var uris = new[] { SpotifyUri.OfAlbum("6akEvsycLGftJxYudPjmqK"), SpotifyUri.OfEpisode("512ojhOuo1ktJprKbVcKyQ") };

            this.MockHttp
            .ExpectSpotifyRequest(HttpMethod.Put, $"me/player/play")
            .WithExactQueryString(string.Empty)
            .WithJsonContent(j =>
                             j.EnumerateObject().Count() == 1 &&
                             j.TryGetProperty("uris", out var array) && array.EnumerateArray().ToArray().Select(x => x.GetString()).SequenceEqual(uris))
            .Respond(HttpStatusCode.OK);

            // Act
            await this.Client.Me.Player.Playback().StartNewAsync(uris);

            // Assert
            this.MockHttp.VerifyNoOutstandingExpectation();
        }
        public async Task ShouldStartNewPlaybackForActiveDeviceFromContextUri()
        {
            // Arrange
            var uri = SpotifyUri.OfAlbum("6akEvsycLGftJxYudPjmqK");

            this.MockHttp
            .ExpectSpotifyRequest(HttpMethod.Put, $"me/player/play")
            .WithExactQueryString(string.Empty)
            .WithJsonContent(j =>
                             j.EnumerateObject().Count() == 1 &&
                             j.TryGetProperty("context_uri", out var contextUri) && contextUri.GetString() == uri)
            .Respond(HttpStatusCode.OK);

            // Act
            await this.Client.Me.Player.Playback().StartNewAsync(uri);

            // Assert
            this.MockHttp.VerifyNoOutstandingExpectation();
        }