Exemple #1
0
        public void GetRequest_ShouldThrowWhenEndpointNull()
        {
            // Given
            Uri endpoint = null;

            // When
            var exception = Record.Exception(() => RestUtilities.GetRequest(ValidMethod, endpoint, null));

            // Then
            exception.Should().BeOfType <ArgumentNullException>().Subject.ParamName.Should().Be("endpoint");
        }
Exemple #2
0
        public void GetRequest_ShouldThrowWhenMethodIsNull()
        {
            // Given
            string method = null;

            // When
            var exception = Record.Exception(() => RestUtilities.GetRequest(method, new Uri(ValidEndpoint), null));

            // Then
            exception.Should().BeOfType <ArgumentNullException>().Subject.ParamName.Should().Be("method");
        }
Exemple #3
0
        public void GetRequest_ShouldThrowWhenUnsupportedMethodGiven()
        {
            // Given
            string method = "SAYHELLO";

            // When
            var exception = Record.Exception(() => RestUtilities.GetRequest(method, new Uri(ValidEndpoint), null));

            // Then
            exception.Should().BeOfType <ArgumentOutOfRangeException>().Subject.ParamName.Should().Be("method");
        }
Exemple #4
0
        public void GetRequest_ShouldSucceed()
        {
            // Given
            // All valid constants
            var endpoint = new Uri(ValidEndpoint);
            // RestSharp (at least for now) doesn't parse query string of resource.
            var resource = endpoint.PathAndQuery;

            // When
            var result = RestUtilities.GetRequest(ValidMethod, endpoint, null);

            // Then
            result.Should().BeAssignableTo <IRestRequest>().
            Subject.Resource.Should().Be(resource);
        }