diff --git a/Bandwidth.Iris.Tests/Helper.cs b/Bandwidth.Iris.Tests/Helper.cs index c443ea5..728300f 100644 --- a/Bandwidth.Iris.Tests/Helper.cs +++ b/Bandwidth.Iris.Tests/Helper.cs @@ -36,8 +36,8 @@ public async static Task ParseXmlContent(HttpContent content) { using (var stream = await content.ReadAsStreamAsync()) { - var serializer = new XmlSerializer(typeof (T)); - return (T) serializer.Deserialize(stream); + var serializer = new XmlSerializer(typeof(T)); + return (T)serializer.Deserialize(stream); } } @@ -54,11 +54,11 @@ public static T ParseXml(string xml) public static void AssertObjects(object estimated, object value) { var type = estimated.GetType(); - foreach(var property in type.GetProperties(BindingFlags.Instance | BindingFlags.Public)) + foreach (var property in type.GetProperties(BindingFlags.Instance | BindingFlags.Public)) { var est = property.GetValue(estimated); var val = property.GetValue(value); - if(est == null && val == null) continue; + if (est == null && val == null) continue; var t = (val ?? est).GetType(); if (t.IsPrimitive || val is IComparable) { @@ -108,7 +108,7 @@ public static string ToXmlStringMinified(object data) using (var writer = new Utf8StringWriter()) - using (var xmlWriter = XmlWriter.Create(writer, new XmlWriterSettings { Indent = false, OmitXmlDeclaration = true})) + using (var xmlWriter = XmlWriter.Create(writer, new XmlWriterSettings { Indent = false, OmitXmlDeclaration = true })) { serializer.Serialize(xmlWriter, data); return writer.ToString(); diff --git a/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs b/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs index 1d77b7b..7f77dda 100644 --- a/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs +++ b/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs @@ -421,5 +421,38 @@ public void TestImportTnOrderDeleteLoasFileMetadata() } } + + [Fact] + public void TestImportTnOrderWithSubscriber() + { + var address = new Address + { + HouseNumber = "123" + }; + + var subscriber = new ImportTnOrderSubscriber + { + Name = "test", + ServiceAddress = address + }; + + var order = new ImportTnOrder + { + Subscriber = subscriber + }; + + Assert.Equal("test", order.Subscriber.Name); + + using (var server = new HttpServer(new RequestHandler + { + EstimatedMethod = "POST", + EstimatedPathAndQuery = $"/v1.0/accounts/{Helper.AccountId}/importTnOrders", + })) + { + var client = Helper.CreateClient(); + ImportTnOrder.Create(client, order).Wait(); + if (server.Error != null) throw server.Error; + } + } } } diff --git a/Bandwidth.Iris/Model/ImportTnOrder.cs b/Bandwidth.Iris/Model/ImportTnOrder.cs index d5496a3..7752a7e 100644 --- a/Bandwidth.Iris/Model/ImportTnOrder.cs +++ b/Bandwidth.Iris/Model/ImportTnOrder.cs @@ -17,7 +17,7 @@ public class ImportTnOrder public string LastModifiedDate { get; set; } public int SiteId { get; set; } public int SipPeerId { get; set; } - public Subscriber Subscriber { get; set; } + public ImportTnOrderSubscriber Subscriber { get; set; } public TelephoneNumber[] TelephoneNumbers { get; set; } public string LoaAuthorizingPerson { get; set; } public string ProcessingStatus { get; set; } @@ -155,6 +155,12 @@ public static Task DeleteLoasFileMetadata(string orderId, string fileId) } + public class ImportTnOrderSubscriber + { + public string Name { get; set; } + public Address ServiceAddress { get; set; } + } + public class fileUploadResponse { [XmlElement("filename")] @@ -194,5 +200,3 @@ public class ImportTnOrderSummary } - -