public void ToRestRequestReturnsRestRequestWithCorrectParameters()
        {
            // Arrange
            var tokensUri = new Uri("/tokens", UriKind.Relative);
            var resourceOwnerPasswordCredentialsGrantTokenRequest = new ResourceOwnerPasswordCredentialsGrantTokenRequest(Username, Password, ClientId, Scope);

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

            // Assert
            var expectedParameters = new List<Parameter>
                       {
                           new Parameter { Name = "grant_type", Value = "password", Type = ParameterType.GetOrPost },
                           new Parameter { Name = "client_id", Value = ClientId, Type = ParameterType.GetOrPost },
                           new Parameter { Name = "username", Value = Username, Type = ParameterType.GetOrPost },
                           new Parameter { Name = "password", Value = Password, Type = ParameterType.GetOrPost },
                           new Parameter { Name = "scope", Value = Scope, Type = ParameterType.GetOrPost }
                       };

            Assert.Equal(expectedParameters, restRequest.Parameters, new ParameterEqualityComparer());
        }
        public void ToRestRequestReturnsRestRequestWithSpecifiedTokensUri()
        {
            // Arrange
            var tokensUri = new Uri("/tokens", UriKind.Relative);
            var resourceOwnerPasswordCredentialsGrantTokenRequest = new ResourceOwnerPasswordCredentialsGrantTokenRequest(Username, Password, ClientId, Scope);

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

            // Assert
            Assert.Equal(tokensUri.ToString(), restRequest.Resource);
        }
        public void ToRestRequestReturnsRestRequestWithMethodIsPost()
        {
            // Arrange
            var tokensUri = new Uri("/tokens", UriKind.Relative);
            var resourceOwnerPasswordCredentialsGrantTokenRequest = new ResourceOwnerPasswordCredentialsGrantTokenRequest(Username, Password, ClientId, Scope);

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

            // Assert
            Assert.Equal(Method.POST, restRequest.Method);
        }
        public void ToRestRequestWithNullTokensUriThrowsArgumentNullException()
        {
            // Arrange
            Uri tokensUri = null;
            var resourceOwnerPasswordCredentialsGrantTokenRequest = new ResourceOwnerPasswordCredentialsGrantTokenRequest(Username, Password, ClientId, Scope);

            // Act

            // Assert
            Assert.Throws<ArgumentNullException>(() => resourceOwnerPasswordCredentialsGrantTokenRequest.ToRestRequest(tokensUri));
        }