public void ToRestRequestWithNullTokensUriThrowsArgumentNullException()
        {
            // Arrange
            Uri tokensUri = null;
            var refreshAccessTokenRequest = new RefreshAccessTokenRequest(RefreshToken, ClientId, ClientSecret);

            // Act

            // Assert
            Assert.Throws<ArgumentNullException>(() => refreshAccessTokenRequest.ToRestRequest(tokensUri));
        }
        public void ToRestRequestReturnsRestRequestWithMethodIsPost()
        {
            // Arrange
            var tokensUri = new Uri("/tokens", UriKind.Relative);
            var refreshAccessTokenRequest = new RefreshAccessTokenRequest(RefreshToken, ClientId, ClientSecret);

            // Act
            var restRequest = refreshAccessTokenRequest.ToRestRequest(tokensUri);

            // Assert
            Assert.Equal(Method.POST, restRequest.Method);
        }
        public void ToRestRequestReturnsRestRequestWithCorrectParameters()
        {
            // Arrange
            var tokensUri = new Uri("/tokens", UriKind.Relative);
            var refreshAccessTokenRequest = new RefreshAccessTokenRequest(RefreshToken, ClientId, ClientSecret);

            // Act
            var restRequest = refreshAccessTokenRequest.ToRestRequest(tokensUri);

            // Assert
            var expectedParameters = new List<Parameter>
                       {
                           new Parameter { Name = "grant_type", Value = "refresh_token", Type = ParameterType.GetOrPost },
                           new Parameter { Name = "client_id", Value = ClientId, Type = ParameterType.GetOrPost },
                           new Parameter { Name = "client_secret", Value = ClientSecret, Type = ParameterType.GetOrPost },
                           new Parameter { Name = "refresh_token", Value = RefreshToken, Type = ParameterType.GetOrPost }
                       };

            Assert.Equal(expectedParameters, restRequest.Parameters, new ParameterEqualityComparer());
        }
        public void ToRestRequestReturnsRestRequestWithSpecifiedTokensUri()
        {
            // Arrange
            var tokensUri = new Uri("/tokens", UriKind.Relative);
            var refreshAccessTokenRequest = new RefreshAccessTokenRequest(RefreshToken, ClientId, ClientSecret);

            // Act
            var restRequest = refreshAccessTokenRequest.ToRestRequest(tokensUri);

            // Assert
            Assert.Equal(tokensUri.ToString(), restRequest.Resource);
        }