public void RunAuthorization()
        {
            var duoRestApiService = new RestApiService(IntegrationKey, SecretKey, Host);

            var adapter = new HttpWebRequestFactory();
            duoRestApiService.QueryDuoApi(adapter, "https", Path, HttpWebRequestMethod.POST, GetQueryValues("*****@*****.**"));
        }
        public void QueryDuoApiShouldResturnNullIfGetResponseReturnsNull()
        {
            // Arrange
            _mockWebRequest.Setup(o => o.GetResponse()).Returns((IHttpWebResponse)null);

            // Act
            var sut = new RestApiService(IntegrationKey, SecretKey, Host);
            var result = sut.QueryDuoApi(_mockWebRequestFactory.Object, "https", "/rest/v1/auth", HttpWebRequestMethod.POST, _queryItems);

            // Assert
            Assert.That(result, Is.Null);
        }
        public void CreateSignedDuoWebRequestShouldReturnAWebRequestWhoseHeaderHasHadAuthorizationAddedTo()
        {
            // Arrange
            var mockWebResponse = new Mock<IHttpWebResponse>(MockBehavior.Strict);
            mockWebResponse.Setup(o => o.GetResponseStream()).Returns(new MemoryStream());
            _mockWebRequest.Setup(o => o.GetResponse()).Returns(mockWebResponse.Object);

            // Act
            var sut = new RestApiService(IntegrationKey, SecretKey, Host);
            sut.QueryDuoApi(_mockWebRequestFactory.Object, "https", "/rest/v1/auth", HttpWebRequestMethod.POST, _queryItems);

            // Assert
            _mockWebRequestFactory.Verify();
            _mockWebRequest.Verify();
        }
        public void QueryDuoApiShouldReturnObjectFromJsonStream()
        {
            // Arrange
            var mockWebResponse = new Mock<IHttpWebResponse>(MockBehavior.Strict);
            mockWebResponse.Setup(o => o.GetResponseStream()).Returns(new MemoryStream()).Verifiable();
            _mockWebRequest.Setup(o => o.GetResponse()).Returns(mockWebResponse.Object);

            // Act
            var sut = new RestApiService(IntegrationKey, SecretKey, Host);
            sut.QueryDuoApi(_mockWebRequestFactory.Object, "https", "/rest/v1/auth", HttpWebRequestMethod.POST, _queryItems);

            // Assert
            _mockWebRequest.Verify();
        }