예제 #1
0
        /// <summary>
        /// Get the number lookup status for the supplied message id.
        /// </summary>
        /// <param name="messageId">The message id of the NumberLookup.</param>
        /// <returns><see cref="NumberLookup"/> object with the supplied message id.</returns>
        /// <exception cref="EntityException">Thrown when no message id was supplied.</exception>
        /// <exception cref="EntityException">Thrown when the server returns a non-success http status code or an invalid response.</exception>
        public NumberLookup GetNumberLookup(string messageId)
        {
            NumberLookup numberLookup = factory.CreateEmptyNumberLookup();

            numberLookup.Populate(messageId);
            return(numberLookup);
        }
예제 #2
0
        public void PopulateTestNull()
        {
            //Arrange
            TwizoClient  client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost);
            NumberLookup lookup = new NumberLookup(client);

            //Act
            lookup.Populate(null);
        }
예제 #3
0
        public void PopulateTestInvalidMessageId()
        {
            //Arrange
            TwizoClient  client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost);
            NumberLookup lookup = new NumberLookup(client);

            //Act
            lookup.Populate("myMessageId");
        }
예제 #4
0
        public void PopulateTest()
        {
            //Arrange
            TwizoClient  client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost);
            NumberLookup lookup = new NumberLookup(client);

            lookup.numbers  = new[] { "601151174973" };
            lookup.validity = 100;
            lookup.tag      = "Unit testing";

            //Act
            Response response  = lookup.Send();
            string   messageId = lookup.messageId;
            var      newLookup = new NumberLookup(client);

            newLookup.Populate(messageId);

            //Assert
            Assert.AreEqual(newLookup.messageId, lookup.messageId);
            Assert.AreEqual(newLookup.validity, lookup.validity);
            Assert.AreEqual(newLookup.tag, lookup.tag);
        }