public void TestInitialize()
        {
            mockSerialiser = new Mock <ISerialiser>();
            mockRestClient = new Mock <IRestClient>();

            service = new SentService(mockRestClient.Object, mockSerialiser.Object);
        }
        private static void GetSentMessagesExample(EsendexCredentials credentials, MessageBodyService messageBodyService)
        {
            var sentService = new SentService(credentials);

            try
            {
                var collection = sentService.GetMessages(_accountReference, PageIndex, PageSize);

                foreach (var item in collection.Messages)
                {
                    if (messageBodyService != null)
                    {
                        messageBodyService.LoadBodyText(item.Body);
                        Console.WriteLine("\tMessage Id:{0}\tSummary:{1}\n\tBody:{2}\n",
                                          item.Id,
                                          item.Summary,
                                          item.Body.BodyText);
                    }
                    else
                    {
                        Console.WriteLine("\tMessage Id:{0}\tSummary:{1}",
                                          item.Id,
                                          item.Summary);
                    }
                }
            }
            catch (WebException ex)
            {
                Console.Write(ex.Message);
            }
        }
        public void TestInitialize()
        {
            mocks = new MockFactory(MockBehavior.Strict);

            mockSerialiser = mocks.Create <ISerialiser>();
            mockRestClient = mocks.Create <IRestClient>();

            service = new SentService(mockRestClient.Object, mockSerialiser.Object);
        }
        public void DefaultConstructor()
        {
            // Arrange
            EsendexCredentials credentials = new EsendexCredentials("username", "password");

            // Act
            SentService serviceInstance = new SentService(credentials);

            // Assert
            Assert.That(serviceInstance.RestClient, Is.InstanceOf <RestClient>());
            Assert.That(serviceInstance.Serialiser, Is.InstanceOf <XmlSerialiser>());
        }
        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
            SentService serviceInstance = new SentService(restClient, serialiser);

            // Assert
            Assert.That(serviceInstance.RestClient, Is.InstanceOf <RestClient>());
            Assert.That(serviceInstance.Serialiser, Is.InstanceOf <XmlSerialiser>());
        }
Ejemplo n.º 6
0
        private static void GetSentMessagesExample()
        {
            int pageNumber = 1;
            int pageSize   = 15;

            SentService sentService = new SentService(Credentials);

            try
            {
                SentMessageCollection collection = sentService.GetMessages(pageNumber, pageSize);

                foreach (SentMessage item in collection.Messages)
                {
                    Console.WriteLine("Message Id:{0}\nMessage:{1}\n\n", item.Id, item.Summary);
                }
            }
            catch (WebException ex)
            {
                Console.Write(ex.Message);
            }
        }
Ejemplo n.º 7
0
 public EsendexSentService(string username, string password, string accountReference)
 {
     _accountReference   = accountReference;
     _sentMessageService = new SentService(username, password);
 }