Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SWI-5092 Add an ImportTnOrderSubscriber model #82

Merged
merged 3 commits into from
Apr 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions Bandwidth.Iris.Tests/Helper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ public async static Task<T> ParseXmlContent<T>(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);
}
}

Expand All @@ -54,11 +54,11 @@ public static T ParseXml<T>(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)
{
Expand Down Expand Up @@ -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();
Expand Down
33 changes: 33 additions & 0 deletions Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
}
}
10 changes: 7 additions & 3 deletions Bandwidth.Iris/Model/ImportTnOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand Down Expand Up @@ -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")]
Expand Down Expand Up @@ -194,5 +200,3 @@ public class ImportTnOrderSummary


}


Loading