コード例 #1
0
        public void TestInitialize()
        {
            httpRequestHelper = new Mock<IHttpRequestHelper>();
            httpResponseHelper = new Mock<IHttpResponseHelper>();
            mockEsendexCredentials = new Mock<EsendexCredentials>();

            var uri = new UriBuilder("http", "tempuri.org").Uri;

            client = new HttpClient(mockEsendexCredentials.Object, uri, httpRequestHelper.Object, httpResponseHelper.Object);
        }
コード例 #2
0
        public void DefaultDIConstructor()
        {
            // Arrange
            Uri uri = new Uri("http://tempuri.org");
            EsendexCredentials credentials = new EsendexCredentials("username", "password");
            IHttpRequestHelper httpRequestHelper = new HttpRequestHelper();
            IHttpResponseHelper httpResponseHelper = new HttpResponseHelper();

            IHttpClient httpClient = new HttpClient(credentials, uri, httpRequestHelper, httpResponseHelper);

            // Act
            RestClient restClientInstance = new RestClient(httpClient);

            // Assert
            Assert.That(restClientInstance.HttpClient, Is.InstanceOf<HttpClient>());
        }
コード例 #3
0
        public void DefaultDIConstructor()
        {
            // Arrange
            var credentials = new EsendexCredentials("username", "password");
            var uri = new Uri("http://tempuri.org");

            var httpRequestHelper = new HttpRequestHelper();
            var httpResponseHelper = new HttpResponseHelper();

            // Act
            var clientInstance = new HttpClient(credentials, uri, httpRequestHelper, httpResponseHelper);

            // Assert
            Assert.That(clientInstance.Credentials, Is.InstanceOf<EsendexCredentials>());
            Assert.That(clientInstance.HttpRequestHelper, Is.InstanceOf<HttpRequestHelper>());
            Assert.That(clientInstance.HttpResponseHelper, Is.InstanceOf<HttpResponseHelper>());
            Assert.That(clientInstance.Uri, Is.InstanceOf<Uri>());
        }
コード例 #4
0
        public void DefaultDIConstructor()
        {
            // Arrange
            Uri uri = new Uri("http://tempuri.org");
            EsendexCredentials credentials = new EsendexCredentials("username", "password");
            IHttpRequestHelper httpRequestHelper = new HttpRequestHelper();
            IHttpResponseHelper httpResponseHelper = new HttpResponseHelper();
            IHttpClient httpClient = new HttpClient(credentials, uri, httpRequestHelper, httpResponseHelper);

            IRestClient restClient = new RestClient(httpClient);
            ISerialiser serialiser = new XmlSerialiser();

            // Act
            SessionService serviceInstance = new SessionService(restClient, serialiser);

            // Assert
            Assert.That(serviceInstance.RestClient, Is.InstanceOf<RestClient>());
            Assert.That(serviceInstance.Serialiser, Is.InstanceOf<XmlSerialiser>());
        }
コード例 #5
0
        public void DefaultDIConstructor()
        {
            // Arrange
            var uri = new Uri("http://tempuri.org");
            var credentials = new EsendexCredentials("username", "password");
            IHttpRequestHelper httpRequestHelper = new HttpRequestHelper();
            IHttpResponseHelper httpResponseHelper = new HttpResponseHelper();
            IHttpClient httpClient = new HttpClient(credentials, uri, httpRequestHelper, httpResponseHelper);

            IRestClient restClient = new RestClient(httpClient);
            ISerialiser serialiser = new XmlSerialiser();

            // Act
            var serviceInstance = new MessagingService(restClient, serialiser, true);

            // Assert
            Assert.That(serviceInstance.RestClient, Is.InstanceOf<RestClient>());
            Assert.That(serviceInstance.Serialiser, Is.InstanceOf<XmlSerialiser>());

            Assert.IsTrue(serviceInstance.EnsureMessageIdsInResult);
        }
コード例 #6
0
        public void TestInitialize()
        {
            mocks = new MockFactory(MockBehavior.Strict);

            mockHttpRequestHelper = mocks.Create<IHttpRequestHelper>();
            mockHttpResponseHelper = mocks.Create<IHttpResponseHelper>();
            mockEsendexCredentials = mocks.Create<EsendexCredentials>();

            Uri uri = new UriBuilder("http", "tempuri.org").Uri;

            client = new HttpClient(mockEsendexCredentials.Object, uri, mockHttpRequestHelper.Object, mockHttpResponseHelper.Object);
        }