/// <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); }
public void PopulateTestInvalidMessageId() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); NumberLookup lookup = new NumberLookup(client); //Act lookup.Populate("myMessageId"); }
public void PopulateTestNull() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); NumberLookup lookup = new NumberLookup(client); //Act lookup.Populate(null); }
public void SendTestNull() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); NumberLookup lookup = new NumberLookup(client); lookup.numbers = null; //Act Response response = lookup.Send(); }
public void SendTest() { //Arrange TwizoClient client = new TwizoClient(TwizoTests.apiKey, TwizoTests.apiHost); NumberLookup lookup = new NumberLookup(client); lookup.numbers = new[] { "601151174973" }; //Act Response response = lookup.Send(); //Assert Assert.AreEqual(response.statusCode, 201); Assert.IsTrue(response.body.Count > 0); }
/// <summary> /// Get the number lookup polling results; returns results only for messages which have result type polling enabled. /// </summary> /// <returns>List of <see cref="NumberLookup"/> objects.</returns> /// <exception cref="EntityException">Thrown when the server returns a non-success http status code or an invalid response.</exception> public List <NumberLookup> GetNumberLookupResults() { List <NumberLookup> result = new List <NumberLookup>(); Poll poll = factory.CreateNumberLookupPoll(); poll.Send(); List <Dictionary <string, object> > messages = poll.GetMessages(); foreach (Dictionary <string, object> message in messages) { NumberLookup NumberLookup = factory.CreateEmptyNumberLookup(); NumberLookup.FillObject(message); result.Add(NumberLookup); } poll.Delete(); return(result); }
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); }