From 53772212ff2d03cfd56192cebf4bd626fb4f4b6b Mon Sep 17 00:00:00 2001
From: AJ Rice <53190766+ajrice6713@users.noreply.github.com>
Date: Wed, 13 Nov 2024 08:57:45 -0500
Subject: [PATCH 1/6] SWI-6456 Fix Method Name Typo
---
Bandwidth.Iris.Tests/Helper.cs | 2 +-
Bandwidth.Iris.Tests/Models/AccountTests.cs | 2 +-
Bandwidth.Iris.Tests/Models/AeuiTests.cs | 2 +-
.../Models/ApplicationTest.cs | 15 ++++---
.../Models/AvailableNpaNxxTests.cs | 2 +-
.../Models/AvailableNumbersTests.cs | 4 +-
Bandwidth.Iris.Tests/Models/CityTests.cs | 2 +-
.../Models/CoveredRateCenterTests.cs | 2 +-
Bandwidth.Iris.Tests/Models/DiscNumberTest.cs | 2 +-
.../Models/DisconnectTests.cs | 4 +-
Bandwidth.Iris.Tests/Models/DldaTests.cs | 12 ++---
.../Models/EmergencyNotificationTests.cs | 4 +-
Bandwidth.Iris.Tests/Models/HostTests.cs | 6 +--
.../Models/ImportTnOrderTests.cs | 2 +-
.../Models/ImportToAccountTests.cs | 2 +-
.../Models/InServiceNumberTest.cs | 4 +-
Bandwidth.Iris.Tests/Models/LidbTests.cs | 2 +-
.../Models/LineOptionTests.cs | 2 +-
.../Models/LnpCheckerTests.cs | 13 +++---
Bandwidth.Iris.Tests/Models/LsrOrderTests.cs | 44 ++++++++++---------
Bandwidth.Iris.Tests/Models/OrderTests.cs | 4 +-
Bandwidth.Iris.Tests/Models/PortInTests.cs | 31 ++++++-------
Bandwidth.Iris.Tests/Models/PortOutTests.cs | 2 +-
.../Models/RateCenterTests.cs | 4 +-
.../Models/RemoveImportedTnOrderTests.cs | 2 +-
Bandwidth.Iris.Tests/Models/SipPeerTests.cs | 2 +-
Bandwidth.Iris.Tests/Models/SiteTests.cs | 13 +++---
.../Models/SubscriptionTests.cs | 8 ++--
Bandwidth.Iris.Tests/Models/TnOptionsTests.cs | 2 +-
.../Models/TnReservationTests.cs | 10 ++---
Bandwidth.Iris.Tests/Models/TnTests.cs | 2 +-
31 files changed, 107 insertions(+), 101 deletions(-)
diff --git a/Bandwidth.Iris.Tests/Helper.cs b/Bandwidth.Iris.Tests/Helper.cs
index 728300f..2530fcf 100644
--- a/Bandwidth.Iris.Tests/Helper.cs
+++ b/Bandwidth.Iris.Tests/Helper.cs
@@ -115,7 +115,7 @@ public static string ToXmlStringMinified(object data)
}
}
- public static void SetEnvironmetVariables(string baseUrl = null)
+ public static void SetEnvironmentVariables(string baseUrl = null)
{
Environment.SetEnvironmentVariable(Client.BandwidthApiUserName, UserName);
Environment.SetEnvironmentVariable(Client.BandwidthApiPassword, Password);
diff --git a/Bandwidth.Iris.Tests/Models/AccountTests.cs b/Bandwidth.Iris.Tests/Models/AccountTests.cs
index f162d6d..bc768c0 100644
--- a/Bandwidth.Iris.Tests/Models/AccountTests.cs
+++ b/Bandwidth.Iris.Tests/Models/AccountTests.cs
@@ -12,7 +12,7 @@ public class AccountTests
// [TestInitialize]
public AccountTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/AeuiTests.cs b/Bandwidth.Iris.Tests/Models/AeuiTests.cs
index ca0ee47..8b7ce03 100644
--- a/Bandwidth.Iris.Tests/Models/AeuiTests.cs
+++ b/Bandwidth.Iris.Tests/Models/AeuiTests.cs
@@ -12,7 +12,7 @@ public class AeuiTests
// [TestInitialize]
public AeuiTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/ApplicationTest.cs b/Bandwidth.Iris.Tests/Models/ApplicationTest.cs
index d4c1543..483e4a8 100644
--- a/Bandwidth.Iris.Tests/Models/ApplicationTest.cs
+++ b/Bandwidth.Iris.Tests/Models/ApplicationTest.cs
@@ -19,7 +19,7 @@ public class ApplicationTest
// [TestInitialize]
public ApplicationTest()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
@@ -55,7 +55,7 @@ public void TestApplicationProvisioningResponse()
var actual = Helper.ToXmlStringMinified(apresponse);
//Linerize the XML
- XDocument doc = XDocument.Parse( TestXmlStrings.multiApplicationProvisionResponse );
+ XDocument doc = XDocument.Parse(TestXmlStrings.multiApplicationProvisionResponse);
var xmlExpected = doc.ToString(SaveOptions.DisableFormatting);
@@ -82,7 +82,7 @@ public void TestApplicationProvisioningResponse()
};
actual = Helper.ToXmlStringMinified(apresponse);
- xmlExpected = XDocument.Parse( TestXmlStrings.singleApplicationProvisionResponse ).ToString(SaveOptions.DisableFormatting);
+ xmlExpected = XDocument.Parse(TestXmlStrings.singleApplicationProvisionResponse).ToString(SaveOptions.DisableFormatting);
Assert.Equal(xmlExpected, actual);
@@ -128,7 +128,7 @@ public void TestAssociatedSipPeersResponse()
public void TestListApplications()
{
- string strResponse = XDocument.Parse(TestXmlStrings.multiApplicationProvisionResponse ).ToString(SaveOptions.DisableFormatting);
+ string strResponse = XDocument.Parse(TestXmlStrings.multiApplicationProvisionResponse).ToString(SaveOptions.DisableFormatting);
using (var server = new HttpServer(new RequestHandler
{
@@ -405,11 +405,12 @@ public void TestGetAssociatesSipPeers400()
{
var r = t.Result;
Assert.True(false, "The exception was not thrown");
- } catch (AggregateException e)
+ }
+ catch (AggregateException e)
{
- e.Handle( ex =>
+ e.Handle(ex =>
{
- if(ex is BandwidthIrisException)
+ if (ex is BandwidthIrisException)
{
Assert.Equal(ex.Message, " Current 1 Account have no Catapult association ");
return true;
diff --git a/Bandwidth.Iris.Tests/Models/AvailableNpaNxxTests.cs b/Bandwidth.Iris.Tests/Models/AvailableNpaNxxTests.cs
index 6f1b1b0..8269bf1 100644
--- a/Bandwidth.Iris.Tests/Models/AvailableNpaNxxTests.cs
+++ b/Bandwidth.Iris.Tests/Models/AvailableNpaNxxTests.cs
@@ -10,7 +10,7 @@ public class AvailableNpaNxxTests
// [TestInitialize]
public AvailableNpaNxxTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/AvailableNumbersTests.cs b/Bandwidth.Iris.Tests/Models/AvailableNumbersTests.cs
index 860f276..a2c2e7a 100644
--- a/Bandwidth.Iris.Tests/Models/AvailableNumbersTests.cs
+++ b/Bandwidth.Iris.Tests/Models/AvailableNumbersTests.cs
@@ -12,7 +12,7 @@ public class AvailableNumbersTests
// [TestInitialize]
public AvailableNumbersTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -25,7 +25,7 @@ public void ListTest()
ContentToSend = Helper.CreateXmlContent(new AvailableNumbersResult
{
ResultCount = 2,
- TelephoneNumberList = new[] { "1111", "2222"}
+ TelephoneNumberList = new[] { "1111", "2222" }
})
}))
{
diff --git a/Bandwidth.Iris.Tests/Models/CityTests.cs b/Bandwidth.Iris.Tests/Models/CityTests.cs
index bc40f2a..9ca73ab 100644
--- a/Bandwidth.Iris.Tests/Models/CityTests.cs
+++ b/Bandwidth.Iris.Tests/Models/CityTests.cs
@@ -12,7 +12,7 @@ public class CityTests
// [TestInitialize]
public CityTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/CoveredRateCenterTests.cs b/Bandwidth.Iris.Tests/Models/CoveredRateCenterTests.cs
index 97ef9d4..461955a 100644
--- a/Bandwidth.Iris.Tests/Models/CoveredRateCenterTests.cs
+++ b/Bandwidth.Iris.Tests/Models/CoveredRateCenterTests.cs
@@ -12,7 +12,7 @@ public class RateCenterTests
// [TestInitialize]
public RateCenterTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/DiscNumberTest.cs b/Bandwidth.Iris.Tests/Models/DiscNumberTest.cs
index bb432c8..76bc7af 100644
--- a/Bandwidth.Iris.Tests/Models/DiscNumberTest.cs
+++ b/Bandwidth.Iris.Tests/Models/DiscNumberTest.cs
@@ -12,7 +12,7 @@ public class DiscNumberTests
// [TestInitialize]
public DiscNumberTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/DisconnectTests.cs b/Bandwidth.Iris.Tests/Models/DisconnectTests.cs
index b63ae9e..afd8800 100644
--- a/Bandwidth.Iris.Tests/Models/DisconnectTests.cs
+++ b/Bandwidth.Iris.Tests/Models/DisconnectTests.cs
@@ -12,7 +12,7 @@ public class DisconnectTests
// [TestInitialize]
public DisconnectTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -25,7 +25,7 @@ public void DisconnectNumbersTest()
{
TelephoneNumberList = new TelephoneNumberList
{
- TelephoneNumbers = new[] {"111", "222" }
+ TelephoneNumbers = new[] { "111", "222" }
}
}
};
diff --git a/Bandwidth.Iris.Tests/Models/DldaTests.cs b/Bandwidth.Iris.Tests/Models/DldaTests.cs
index bdd5552..5eca456 100644
--- a/Bandwidth.Iris.Tests/Models/DldaTests.cs
+++ b/Bandwidth.Iris.Tests/Models/DldaTests.cs
@@ -12,7 +12,7 @@ public class DldaTests
// [TestInitialize]
public DldaTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -22,7 +22,7 @@ public void GetTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas/1", Helper.AccountId),
- ContentToSend = new StringContent(TestXmlStrings.Dlda, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.Dlda, Encoding.UTF8, "application/xml")
}))
{
var client = Helper.CreateClient();
@@ -41,7 +41,7 @@ public void GetWithDefaultClientTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas/1", Helper.AccountId),
- ContentToSend = new StringContent(TestXmlStrings.Dlda, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.Dlda, Encoding.UTF8, "application/xml")
}))
{
var result = Dlda.Get("1").Result;
@@ -57,7 +57,7 @@ public void ListTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas", Helper.AccountId),
- ContentToSend = new StringContent(TestXmlStrings.Dldas, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.Dldas, Encoding.UTF8, "application/xml")
}))
{
var client = Helper.CreateClient();
@@ -73,7 +73,7 @@ public void ListWithDefaultClientTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/dldas", Helper.AccountId),
- ContentToSend = new StringContent(TestXmlStrings.Dldas, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.Dldas, Encoding.UTF8, "application/xml")
}))
{
var result = Dlda.List().Result;
@@ -213,7 +213,7 @@ public void GetHistoryTest()
}))
{
var client = Helper.CreateClient();
- var i = new Dlda {Id = "1"};
+ var i = new Dlda { Id = "1" };
i.SetClient(client);
var result = i.GetHistory().Result;
if (server.Error != null) throw server.Error;
diff --git a/Bandwidth.Iris.Tests/Models/EmergencyNotificationTests.cs b/Bandwidth.Iris.Tests/Models/EmergencyNotificationTests.cs
index 6080d9a..bf9f7ef 100644
--- a/Bandwidth.Iris.Tests/Models/EmergencyNotificationTests.cs
+++ b/Bandwidth.Iris.Tests/Models/EmergencyNotificationTests.cs
@@ -13,7 +13,7 @@ public class EmergencyNotificationTests
// [TestInitialize]
public EmergencyNotificationTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -195,7 +195,7 @@ public void TestListGroupOrder()
if (server.Error != null) throw server.Error;
Assert.NotNull(result);
- Assert.NotNull( result.Links);
+ Assert.NotNull(result.Links);
Assert.NotNull(result.EmergencyNotificationGroupOrders);
Assert.Equal(3, result.EmergencyNotificationGroupOrders.Length);
diff --git a/Bandwidth.Iris.Tests/Models/HostTests.cs b/Bandwidth.Iris.Tests/Models/HostTests.cs
index cce6cc3..5d75ed0 100644
--- a/Bandwidth.Iris.Tests/Models/HostTests.cs
+++ b/Bandwidth.Iris.Tests/Models/HostTests.cs
@@ -12,7 +12,7 @@ public class HostTests
// [TestInitialize]
public HostTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -22,7 +22,7 @@ public void ListTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/hosts", Helper.AccountId),
- ContentToSend = new StringContent(TestXmlStrings.Hosts, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.Hosts, Encoding.UTF8, "application/xml")
}))
{
var client = Helper.CreateClient();
@@ -39,7 +39,7 @@ public void ListWithDefaultClientTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/hosts", Helper.AccountId),
- ContentToSend = new StringContent(TestXmlStrings.Hosts, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.Hosts, Encoding.UTF8, "application/xml")
}))
{
var result = Host.List().Result;
diff --git a/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs b/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs
index 7f77dda..8e5981c 100644
--- a/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs
+++ b/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs
@@ -14,7 +14,7 @@ public class ImportTnOrderTests
// [TestInitialize]
public ImportTnOrderTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/ImportToAccountTests.cs b/Bandwidth.Iris.Tests/Models/ImportToAccountTests.cs
index ed6425f..37ed8ad 100644
--- a/Bandwidth.Iris.Tests/Models/ImportToAccountTests.cs
+++ b/Bandwidth.Iris.Tests/Models/ImportToAccountTests.cs
@@ -12,7 +12,7 @@ public class ImportToAccountTests
// [TestInitialize]
public ImportToAccountTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/InServiceNumberTest.cs b/Bandwidth.Iris.Tests/Models/InServiceNumberTest.cs
index 0a805d3..0ed9604 100644
--- a/Bandwidth.Iris.Tests/Models/InServiceNumberTest.cs
+++ b/Bandwidth.Iris.Tests/Models/InServiceNumberTest.cs
@@ -12,7 +12,7 @@ public class InServiceNumberTests
// [TestInitialize]
public InServiceNumberTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -22,7 +22,7 @@ public void ListTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/inserviceNumbers", Helper.AccountId),
- ContentToSend = new StringContent(TestXmlStrings.InServiceNumbers, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.InServiceNumbers, Encoding.UTF8, "application/xml")
}))
{
var client = Helper.CreateClient();
diff --git a/Bandwidth.Iris.Tests/Models/LidbTests.cs b/Bandwidth.Iris.Tests/Models/LidbTests.cs
index f94914d..6ea48c2 100644
--- a/Bandwidth.Iris.Tests/Models/LidbTests.cs
+++ b/Bandwidth.Iris.Tests/Models/LidbTests.cs
@@ -12,7 +12,7 @@ public class LidbTests
// [TestInitialize]
public LidbTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/LineOptionTests.cs b/Bandwidth.Iris.Tests/Models/LineOptionTests.cs
index d9976b2..1261167 100644
--- a/Bandwidth.Iris.Tests/Models/LineOptionTests.cs
+++ b/Bandwidth.Iris.Tests/Models/LineOptionTests.cs
@@ -12,7 +12,7 @@ public class LineOptionTests
// [TestInitialize]
public LineOptionTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/LnpCheckerTests.cs b/Bandwidth.Iris.Tests/Models/LnpCheckerTests.cs
index aff4200..d7fedd3 100644
--- a/Bandwidth.Iris.Tests/Models/LnpCheckerTests.cs
+++ b/Bandwidth.Iris.Tests/Models/LnpCheckerTests.cs
@@ -12,7 +12,7 @@ public class LnpCheckerTests
// [TestInitialize]
public LnpCheckerTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -64,7 +64,7 @@ public void CheckThrowsErrorTest()
"170",
"error thrown",
System.Net.HttpStatusCode.ExpectationFailed
- ) ;
+ );
using (var server = new HttpServer(new RequestHandler
{
EstimatedMethod = "POST",
@@ -72,20 +72,21 @@ public void CheckThrowsErrorTest()
EstimatedContent = Helper.ToXmlString(request),
ContentToSend = new StringContent("919220216491978911467331
Rate Center Not Present in Bandwidth Dashboard5555555555DURHAMDURHAMNC42609192202164RALEIGHRALEIGHNC42609197891146", Encoding.UTF8, "application/xml")
- }))
+ }))
{
var client = Helper.CreateClient();
try
{
var result = LnpChecker.Check(client, new[] { "1111" }, true).Result;
- } catch (BandwidthIrisException e )
+ }
+ catch (BandwidthIrisException e)
{
return;
}
catch (AggregateException e)
{
Exception innerEx = e;
- while(innerEx != null)
+ while (innerEx != null)
{
string mesg = innerEx.Message;
innerEx = innerEx.InnerException;
@@ -93,7 +94,7 @@ public void CheckThrowsErrorTest()
}
return;
}
- catch (Exception e)
+ catch (Exception e)
{
return;
}
diff --git a/Bandwidth.Iris.Tests/Models/LsrOrderTests.cs b/Bandwidth.Iris.Tests/Models/LsrOrderTests.cs
index 6b372a9..10f9e9c 100644
--- a/Bandwidth.Iris.Tests/Models/LsrOrderTests.cs
+++ b/Bandwidth.Iris.Tests/Models/LsrOrderTests.cs
@@ -12,7 +12,7 @@ public class LsrOrderTests
// [TestInitialize]
public LsrOrderTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -88,26 +88,28 @@ public void CreateTest()
{
var item = new LsrOrder
{
- Pon = "Some Pon",
- CustomerOrderId = "MyId5",
- Spid = "123C",
- BillingTelephoneNumber = "9192381468",
- AuthorizingPerson = "Jim Hopkins",
- Subscriber = new Subscriber{
- SubscriberType = "BUSINESS",
- BusinessName = "BusinessName",
- ServiceAddress = new Address {
- HouseNumber ="11",
- StreetName = "Park",
- StreetSuffix = "Ave",
- City = "New York",
- StateCode = "NY",
- Zip = "90025"
- },
- AccountNumber = "123463",
- PinNumber = "1231"
- },
- ListOfTelephoneNumbers = new[]{"9192381848", "9192381467"}
+ Pon = "Some Pon",
+ CustomerOrderId = "MyId5",
+ Spid = "123C",
+ BillingTelephoneNumber = "9192381468",
+ AuthorizingPerson = "Jim Hopkins",
+ Subscriber = new Subscriber
+ {
+ SubscriberType = "BUSINESS",
+ BusinessName = "BusinessName",
+ ServiceAddress = new Address
+ {
+ HouseNumber = "11",
+ StreetName = "Park",
+ StreetSuffix = "Ave",
+ City = "New York",
+ StateCode = "NY",
+ Zip = "90025"
+ },
+ AccountNumber = "123463",
+ PinNumber = "1231"
+ },
+ ListOfTelephoneNumbers = new[] { "9192381848", "9192381467" }
};
using (var server = new HttpServer(new[]
diff --git a/Bandwidth.Iris.Tests/Models/OrderTests.cs b/Bandwidth.Iris.Tests/Models/OrderTests.cs
index b9b0643..0efe803 100644
--- a/Bandwidth.Iris.Tests/Models/OrderTests.cs
+++ b/Bandwidth.Iris.Tests/Models/OrderTests.cs
@@ -13,7 +13,7 @@ public class OrderTests
// [TestInitialize]
public OrderTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -239,7 +239,7 @@ public void GetWithDefaultClientTest()
[Fact]
public void UpdateTest()
{
- var item = new Order {Id = "101"};
+ var item = new Order { Id = "101" };
var data = new Order
{
Name = "Test",
diff --git a/Bandwidth.Iris.Tests/Models/PortInTests.cs b/Bandwidth.Iris.Tests/Models/PortInTests.cs
index b9fe9e0..6f71611 100644
--- a/Bandwidth.Iris.Tests/Models/PortInTests.cs
+++ b/Bandwidth.Iris.Tests/Models/PortInTests.cs
@@ -16,7 +16,7 @@ public class PortInTests
// [TestInitialize]
public PortInTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -27,14 +27,14 @@ public void CreateTest()
BillingTelephoneNumber = "1111",
Subscriber = new Subscriber
{
- SubscriberType = "BUSINESS",
- BusinessName = "Company",
- ServiceAddress = new Address
- {
- City = "City",
- StateCode = "State",
- Country = "County"
- }
+ SubscriberType = "BUSINESS",
+ BusinessName = "Company",
+ ServiceAddress = new Address
+ {
+ City = "City",
+ StateCode = "State",
+ Country = "County"
+ }
},
SiteId = "1"
};
@@ -145,11 +145,11 @@ public void CreateFileTest()
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/portins/1/loas", Helper.AccountId),
EstimatedContent = data,
EstimatedHeaders = new Dictionary { { "Content-Type", "media/type" } },
- ContentToSend = Helper.CreateXmlContent(new FileResult{FileName = "test"})
+ ContentToSend = Helper.CreateXmlContent(new FileResult { FileName = "test" })
}))
{
var client = Helper.CreateClient();
- var portIn = new PortIn{Id = "1"};
+ var portIn = new PortIn { Id = "1" };
portIn.SetClient(client);
using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(data)))
{
@@ -280,7 +280,7 @@ public void GetFile2Test()
var portIn = new PortIn { Id = "1" };
portIn.SetClient(client);
using (var r = portIn.GetFile("test", true).Result)
- using(var reader = new StreamReader(r.Stream, Encoding.UTF8))
+ using (var reader = new StreamReader(r.Stream, Encoding.UTF8))
{
Assert.Equal("media/type", r.MediaType);
Assert.Equal(data, reader.ReadToEnd());
@@ -340,7 +340,8 @@ public void PutFileMetadataTest()
}))
{
- var fileMetadata = new FileMetadata {
+ var fileMetadata = new FileMetadata
+ {
DocumentType = "INVOICE",
DocumentName = "docName"
};
@@ -376,7 +377,7 @@ public void UpdateTest()
var data = new LnpOrderSupp
{
RequestedFocDate = DateTime.Parse("2014-11-18T00:00:00.000Z"),
- WirelessInfo = new []{new WirelessInfo
+ WirelessInfo = new[]{new WirelessInfo
{
AccountNumber = "77129766500001",
PinNumber = "0000"
@@ -430,7 +431,7 @@ public void AddNoteTest()
UserId = "customer",
Description = "Test"
};
- using (var server = new HttpServer(new []{
+ using (var server = new HttpServer(new[]{
new RequestHandler
{
EstimatedMethod = "POST",
diff --git a/Bandwidth.Iris.Tests/Models/PortOutTests.cs b/Bandwidth.Iris.Tests/Models/PortOutTests.cs
index 2d3ccc3..ef4b7df 100644
--- a/Bandwidth.Iris.Tests/Models/PortOutTests.cs
+++ b/Bandwidth.Iris.Tests/Models/PortOutTests.cs
@@ -12,7 +12,7 @@ public class PortOutTests
// [TestInitialize]
public PortOutTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/RateCenterTests.cs b/Bandwidth.Iris.Tests/Models/RateCenterTests.cs
index 1f0ab1c..54dc7d3 100644
--- a/Bandwidth.Iris.Tests/Models/RateCenterTests.cs
+++ b/Bandwidth.Iris.Tests/Models/RateCenterTests.cs
@@ -12,7 +12,7 @@ public class CoveredRateCenterTests
// [TestInitialize]
public CoveredRateCenterTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -51,7 +51,7 @@ public void ListWithDefaultClientTest()
ContentToSend = new StringContent(TestXmlStrings.RateCentersResponse, Encoding.UTF8, "application/xml")
}))
{
- var result = RateCenter.List( new Dictionary
+ var result = RateCenter.List(new Dictionary
{
{"state", "NC"}
}).Result;
diff --git a/Bandwidth.Iris.Tests/Models/RemoveImportedTnOrderTests.cs b/Bandwidth.Iris.Tests/Models/RemoveImportedTnOrderTests.cs
index c535e6a..ffd77d6 100644
--- a/Bandwidth.Iris.Tests/Models/RemoveImportedTnOrderTests.cs
+++ b/Bandwidth.Iris.Tests/Models/RemoveImportedTnOrderTests.cs
@@ -13,7 +13,7 @@ public class RemoveImportedTnOrderTests
// [TestInitialize]
public RemoveImportedTnOrderTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/SipPeerTests.cs b/Bandwidth.Iris.Tests/Models/SipPeerTests.cs
index 1ea41a7..d08b192 100644
--- a/Bandwidth.Iris.Tests/Models/SipPeerTests.cs
+++ b/Bandwidth.Iris.Tests/Models/SipPeerTests.cs
@@ -12,7 +12,7 @@ public class SipPeerTests
// [TestInitialize]
public SipPeerTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
public void CreateTest()
diff --git a/Bandwidth.Iris.Tests/Models/SiteTests.cs b/Bandwidth.Iris.Tests/Models/SiteTests.cs
index 7c533de..867a1fd 100644
--- a/Bandwidth.Iris.Tests/Models/SiteTests.cs
+++ b/Bandwidth.Iris.Tests/Models/SiteTests.cs
@@ -13,7 +13,7 @@ public class SiteTests
// [TestInitialize]
public SiteTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -33,7 +33,7 @@ public void GetTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/sites/1", Helper.AccountId),
- ContentToSend = Helper.CreateXmlContent(new SiteResponse{Site = item})
+ ContentToSend = Helper.CreateXmlContent(new SiteResponse { Site = item })
}))
{
var client = Helper.CreateClient();
@@ -145,7 +145,7 @@ public void ListTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/sites", Helper.AccountId),
- ContentToSend = Helper.CreateXmlContent(new SitesResponse{Sites = items})
+ ContentToSend = Helper.CreateXmlContent(new SitesResponse { Sites = items })
}))
{
var client = Helper.CreateClient();
@@ -325,7 +325,7 @@ public void UpdateTest()
}))
{
var client = Helper.CreateClient();
- var i = new Site {Id = "1"};
+ var i = new Site { Id = "1" };
i.SetClient(client);
i.Update(item).Wait();
if (server.Error != null) throw server.Error;
@@ -558,11 +558,12 @@ public void BandwidthIrisExcpetionTest()
try
{
var i = Site.Get("1").Result;
- } catch (AggregateException e)
+ }
+ catch (AggregateException e)
{
e.Handle((x) =>
{
- if(x is BandwidthIrisException)
+ if (x is BandwidthIrisException)
{
error = true;
return true;
diff --git a/Bandwidth.Iris.Tests/Models/SubscriptionTests.cs b/Bandwidth.Iris.Tests/Models/SubscriptionTests.cs
index cbe77c9..c4ef807 100644
--- a/Bandwidth.Iris.Tests/Models/SubscriptionTests.cs
+++ b/Bandwidth.Iris.Tests/Models/SubscriptionTests.cs
@@ -12,7 +12,7 @@ public class SubscriptionTests
// [TestInitialize]
public SubscriptionTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -33,7 +33,7 @@ public void GetTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/subscriptions/1", Helper.AccountId),
- ContentToSend = Helper.CreateXmlContent(new SubscriptionsResponse { Subscriptions = new []{item} })
+ ContentToSend = Helper.CreateXmlContent(new SubscriptionsResponse { Subscriptions = new[] { item } })
}))
{
var client = Helper.CreateClient();
@@ -124,7 +124,7 @@ public void ListTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/subscriptions", Helper.AccountId),
- ContentToSend = Helper.CreateXmlContent(new SubscriptionsResponse{Subscriptions = items})
+ ContentToSend = Helper.CreateXmlContent(new SubscriptionsResponse { Subscriptions = items })
}))
{
var client = Helper.CreateClient();
@@ -307,7 +307,7 @@ public void UpdateTest()
}))
{
var client = Helper.CreateClient();
- var i = new Subscription {Id = "1"};
+ var i = new Subscription { Id = "1" };
i.SetClient(client);
i.Update(item).Wait();
if (server.Error != null) throw server.Error;
diff --git a/Bandwidth.Iris.Tests/Models/TnOptionsTests.cs b/Bandwidth.Iris.Tests/Models/TnOptionsTests.cs
index beb1ed0..a727585 100644
--- a/Bandwidth.Iris.Tests/Models/TnOptionsTests.cs
+++ b/Bandwidth.Iris.Tests/Models/TnOptionsTests.cs
@@ -13,7 +13,7 @@ public class TnOptionsTests
// [TestInitialize]
public TnOptionsTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
diff --git a/Bandwidth.Iris.Tests/Models/TnReservationTests.cs b/Bandwidth.Iris.Tests/Models/TnReservationTests.cs
index f81353d..78752eb 100644
--- a/Bandwidth.Iris.Tests/Models/TnReservationTests.cs
+++ b/Bandwidth.Iris.Tests/Models/TnReservationTests.cs
@@ -13,7 +13,7 @@ public class TnReservationTests
// [TestInitialize]
public TnReservationTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
@@ -23,7 +23,7 @@ public void GetTest()
{
Id = "1",
AccountId = "111",
- ReservedTn = new[]{"000"},
+ ReservedTn = new[] { "000" },
ReservationExpires = 0
};
using (var server = new HttpServer(new RequestHandler
@@ -97,7 +97,7 @@ public void GetWithDefaultClientTest()
{
Id = "1",
AccountId = "111",
- ReservedTn = new []{"000"},
+ ReservedTn = new[] { "000" },
ReservationExpires = 0
};
using (var server = new HttpServer(new RequestHandler
@@ -119,7 +119,7 @@ public void CreateTest()
var item = new TnReservation
{
AccountId = "111",
- ReservedTn = new[]{"000"},
+ ReservedTn = new[] { "000" },
ReservationExpires = 0
};
@@ -157,7 +157,7 @@ public void CreateWithDefaultClientTest()
var item = new TnReservation
{
AccountId = "111",
- ReservedTn = new []{"000"},
+ ReservedTn = new[] { "000" },
ReservationExpires = 0
};
diff --git a/Bandwidth.Iris.Tests/Models/TnTests.cs b/Bandwidth.Iris.Tests/Models/TnTests.cs
index c0481aa..7e78c50 100644
--- a/Bandwidth.Iris.Tests/Models/TnTests.cs
+++ b/Bandwidth.Iris.Tests/Models/TnTests.cs
@@ -12,7 +12,7 @@ public class TnTests
// [TestInitialize]
public TnTests()
{
- Helper.SetEnvironmetVariables();
+ Helper.SetEnvironmentVariables();
}
[Fact]
From 656d16568c79649265ec7288d3c94bbdc58c15b5 Mon Sep 17 00:00:00 2001
From: AJ Rice <53190766+ajrice6713@users.noreply.github.com>
Date: Wed, 13 Nov 2024 09:42:12 -0500
Subject: [PATCH 2/6] `dotnet clean && dotnet format`
---
Bandwidth.Iris.Tests/ClientTests.cs | 19 ++-
.../Models/ApplicationTest.cs | 88 +++++-----
.../Models/CoveredRateCenterTests.cs | 4 +-
Bandwidth.Iris.Tests/Models/CsrTest.cs | 160 +++++++++---------
.../Models/DisconnectTests.cs | 1 +
.../Models/EmergencyNotificationTests.cs | 4 +-
Bandwidth.Iris.Tests/Models/HostTests.cs | 8 +-
.../Models/ImportTnCheckerTests.cs | 10 +-
.../Models/ImportTnOrderTests.cs | 80 ++++-----
.../Models/LineOptionTests.cs | 4 +-
Bandwidth.Iris.Tests/Models/OrderTests.cs | 16 +-
Bandwidth.Iris.Tests/Models/PortInTests.cs | 4 +-
.../Models/RemoveImportedTnOrderTests.cs | 50 +++---
Bandwidth.Iris.Tests/Models/SipPeerTests.cs | 46 ++---
Bandwidth.Iris.Tests/Models/SiteTests.cs | 4 +-
.../Models/SubscriptionTests.cs | 2 +-
Bandwidth.Iris.Tests/Models/TnTests.cs | 1 +
Bandwidth.Iris/BandwidthIrisException.cs | 4 +-
Bandwidth.Iris/Client.cs | 31 ++--
Bandwidth.Iris/Model/Account.cs | 4 +-
Bandwidth.Iris/Model/Application.cs | 6 +-
Bandwidth.Iris/Model/AvailableNumbers.cs | 2 +-
Bandwidth.Iris/Model/Csr.cs | 6 +-
Bandwidth.Iris/Model/Disconnect.cs | 10 +-
Bandwidth.Iris/Model/Dlda.cs | 20 +--
Bandwidth.Iris/Model/Host.cs | 2 +-
Bandwidth.Iris/Model/InServiceNumber.cs | 4 +-
Bandwidth.Iris/Model/Lidb.cs | 32 ++--
Bandwidth.Iris/Model/LineOptionOrder.cs | 6 +-
Bandwidth.Iris/Model/LnpChecker.cs | 2 +-
Bandwidth.Iris/Model/LsrOrder.cs | 41 ++---
Bandwidth.Iris/Model/Note.cs | 2 +-
Bandwidth.Iris/Model/Order.cs | 17 +-
Bandwidth.Iris/Model/PortIn.cs | 29 ++--
Bandwidth.Iris/Model/PortOut.cs | 2 +-
Bandwidth.Iris/Model/SipPeer.cs | 34 ++--
Bandwidth.Iris/Model/Site.cs | 12 +-
Bandwidth.Iris/Model/Subscription.cs | 9 +-
Bandwidth.Iris/Model/TnReservation.cs | 4 +-
Bandwidth.Iris/Utf8StringWriter.cs | 2 +-
40 files changed, 395 insertions(+), 387 deletions(-)
diff --git a/Bandwidth.Iris.Tests/ClientTests.cs b/Bandwidth.Iris.Tests/ClientTests.cs
index d363b62..53564ef 100644
--- a/Bandwidth.Iris.Tests/ClientTests.cs
+++ b/Bandwidth.Iris.Tests/ClientTests.cs
@@ -29,7 +29,8 @@ public void GetInstanceTest()
[Fact]
public void MakeGetRequestTest()
{
- using (var server = new HttpServer(new RequestHandler {
+ using (var server = new HttpServer(new RequestHandler
+ {
EstimatedMethod = "GET",
EstimatedPathAndQuery = "/v1.0/test?test1=value1&test2=value2",
EstimatedHeaders = new Dictionary
@@ -75,7 +76,7 @@ public void MakeGetRequestTTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = "/v1.0/test?test1=value1&test2=value2",
- ContentToSend = Helper.CreateXmlContent(new TestItem
+ ContentToSend = Helper.CreateXmlContent(new TestItem
{
Name = "Name",
Flag = true
@@ -141,7 +142,7 @@ public void MakePostRequestTTest()
{
EstimatedMethod = "POST",
EstimatedPathAndQuery = "/v1.0/test",
- EstimatedContent = Helper.ToXmlString(new TestModel{Test = true}),
+ EstimatedContent = Helper.ToXmlString(new TestModel { Test = true }),
ContentToSend = Helper.CreateXmlContent(new TestItem
{
Name = "Name",
@@ -151,7 +152,7 @@ public void MakePostRequestTTest()
{
var client = Helper.CreateClient();
{
- var result = client.MakePostRequest("test", new TestModel{ Test = true }).Result;
+ var result = client.MakePostRequest("test", new TestModel { Test = true }).Result;
if (server.Error != null) throw server.Error;
Assert.Equal("Name", result.Name);
Assert.True(result.Flag != null && result.Flag.Value);
@@ -183,7 +184,7 @@ public void AuthHeaderTest()
using (var server = new HttpServer(new RequestHandler
{
EstimatedMethod = "GET",
- EstimatedHeaders = new Dictionary { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:{1}", Helper.UserName, Helper.Password)))} },
+ EstimatedHeaders = new Dictionary { { "Authorization", "Basic " + Convert.ToBase64String(Encoding.UTF8.GetBytes(string.Format("{0}:{1}", Helper.UserName, Helper.Password))) } },
ContentToSend = Helper.CreateXmlContent(new SitesResponse())
}))
{
@@ -203,13 +204,13 @@ public void PutDataWithStreamTest()
EstimatedMethod = "PUT",
EstimatedPathAndQuery = "/v1.0/test",
EstimatedContent = "hello",
- EstimatedHeaders = new Dictionary {{"Content-Type", "media/type"}}
+ EstimatedHeaders = new Dictionary { { "Content-Type", "media/type" } }
}))
{
var client = Helper.CreateClient();
using (var stream = new MemoryStream(data))
{
- client.SendData("test", stream, "media/type", "PUT", true).Wait();
+ client.SendData("test", stream, "media/type", "PUT", true).Wait();
if (server.Error != null) throw server.Error;
}
}
@@ -228,7 +229,7 @@ public void SendDataWithByteArrayTest()
}))
{
var client = Helper.CreateClient();
- client.SendData("test", new MemoryStream( data), "media/type", "PUT", true).Wait();
+ client.SendData("test", new MemoryStream(data), "media/type", "PUT", true).Wait();
if (server.Error != null) throw server.Error;
}
@@ -361,7 +362,7 @@ public void Error3Test()
catch (AggregateException ex)
{
var err = (AggregateException)ex.InnerExceptions.First();
- var list = (from e in err.InnerExceptions select (BandwidthIrisException) e).ToArray();
+ var list = (from e in err.InnerExceptions select (BandwidthIrisException)e).ToArray();
Assert.Equal("101", list[0].Code);
Assert.Equal("Description1", list[0].Message);
Assert.Equal("102", list[1].Code);
diff --git a/Bandwidth.Iris.Tests/Models/ApplicationTest.cs b/Bandwidth.Iris.Tests/Models/ApplicationTest.cs
index 483e4a8..ad7004c 100644
--- a/Bandwidth.Iris.Tests/Models/ApplicationTest.cs
+++ b/Bandwidth.Iris.Tests/Models/ApplicationTest.cs
@@ -144,12 +144,12 @@ public void TestListApplications()
var r = t.Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(r.ApplicationList.Length, 2);
+ Assert.Equal(2, r.ApplicationList.Length);
- Assert.Equal(r.ApplicationList[0].ApplicationId, "2cfcb382-161c-46d4-8c67-87ca09a72c85");
- Assert.Equal(r.ApplicationList[0].ServiceType, "Messaging-V2");
- Assert.Equal(r.ApplicationList[0].AppName, "app1");
- Assert.Equal(r.ApplicationList[0].MsgCallbackUrl, "http://a.com");
+ Assert.Equal("2cfcb382-161c-46d4-8c67-87ca09a72c85", r.ApplicationList[0].ApplicationId);
+ Assert.Equal("Messaging-V2", r.ApplicationList[0].ServiceType);
+ Assert.Equal("app1", r.ApplicationList[0].AppName);
+ Assert.Equal("http://a.com", r.ApplicationList[0].MsgCallbackUrl);
}
@@ -192,14 +192,14 @@ public void TestCreateApplication()
Assert.NotNull(r.Application);
- Assert.Equal(r.Application.ApplicationId, "d3e418e9-1833-49c1-b6c7-ca1700f79586");
- Assert.Equal(r.Application.ServiceType, "Voice-V2");
- Assert.Equal(r.Application.AppName, "v1");
- Assert.Equal(r.Application.CallInitiatedCallbackUrl, "https://a.com");
- Assert.Equal(r.Application.CallStatusCallbackUrl, "https://b.com");
- Assert.Equal(r.Application.CallInitiatedMethod, "GET");
- Assert.Equal(r.Application.CallStatusMethod, "GET");
- Assert.Equal(r.Application.CallbackCreds.UserId, "login123");
+ Assert.Equal("d3e418e9-1833-49c1-b6c7-ca1700f79586", r.Application.ApplicationId);
+ Assert.Equal("Voice-V2", r.Application.ServiceType);
+ Assert.Equal("v1", r.Application.AppName);
+ Assert.Equal("https://a.com", r.Application.CallInitiatedCallbackUrl);
+ Assert.Equal("https://b.com", r.Application.CallStatusCallbackUrl);
+ Assert.Equal("GET", r.Application.CallInitiatedMethod);
+ Assert.Equal("GET", r.Application.CallStatusMethod);
+ Assert.Equal("login123", r.Application.CallbackCreds.UserId);
}
@@ -230,14 +230,14 @@ public void TestGetApplication()
Assert.NotNull(r.Application);
- Assert.Equal(r.Application.ApplicationId, "d3e418e9-1833-49c1-b6c7-ca1700f79586");
- Assert.Equal(r.Application.ServiceType, "Voice-V2");
- Assert.Equal(r.Application.AppName, "v1");
- Assert.Equal(r.Application.CallInitiatedCallbackUrl, "https://a.com");
- Assert.Equal(r.Application.CallStatusCallbackUrl, "https://b.com");
- Assert.Equal(r.Application.CallInitiatedMethod, "GET");
- Assert.Equal(r.Application.CallStatusMethod, "GET");
- Assert.Equal(r.Application.CallbackCreds.UserId, "login123");
+ Assert.Equal("d3e418e9-1833-49c1-b6c7-ca1700f79586", r.Application.ApplicationId);
+ Assert.Equal("Voice-V2", r.Application.ServiceType);
+ Assert.Equal("v1", r.Application.AppName);
+ Assert.Equal("https://a.com", r.Application.CallInitiatedCallbackUrl);
+ Assert.Equal("https://b.com", r.Application.CallStatusCallbackUrl);
+ Assert.Equal("GET", r.Application.CallInitiatedMethod);
+ Assert.Equal("GET", r.Application.CallStatusMethod);
+ Assert.Equal("login123", r.Application.CallbackCreds.UserId);
}
@@ -272,14 +272,14 @@ public void TestFullUpdateApplication()
Assert.NotNull(r.Application);
- Assert.Equal(r.Application.ApplicationId, "d3e418e9-1833-49c1-b6c7-ca1700f79586");
- Assert.Equal(r.Application.ServiceType, "Voice-V2");
- Assert.Equal(r.Application.AppName, "v1");
- Assert.Equal(r.Application.CallInitiatedCallbackUrl, "https://a.com");
- Assert.Equal(r.Application.CallStatusCallbackUrl, "https://b.com");
- Assert.Equal(r.Application.CallInitiatedMethod, "GET");
- Assert.Equal(r.Application.CallStatusMethod, "GET");
- Assert.Equal(r.Application.CallbackCreds.UserId, "login123");
+ Assert.Equal("d3e418e9-1833-49c1-b6c7-ca1700f79586", r.Application.ApplicationId);
+ Assert.Equal("Voice-V2", r.Application.ServiceType);
+ Assert.Equal("v1", r.Application.AppName);
+ Assert.Equal("https://a.com", r.Application.CallInitiatedCallbackUrl);
+ Assert.Equal("https://b.com", r.Application.CallStatusCallbackUrl);
+ Assert.Equal("GET", r.Application.CallInitiatedMethod);
+ Assert.Equal("GET", r.Application.CallStatusMethod);
+ Assert.Equal("login123", r.Application.CallbackCreds.UserId);
}
@@ -314,14 +314,14 @@ public void TestPartialUpdateApplication()
Assert.NotNull(r.Application);
- Assert.Equal(r.Application.ApplicationId, "d3e418e9-1833-49c1-b6c7-ca1700f79586");
- Assert.Equal(r.Application.ServiceType, "Voice-V2");
- Assert.Equal(r.Application.AppName, "v1");
- Assert.Equal(r.Application.CallInitiatedCallbackUrl, "https://a.com");
- Assert.Equal(r.Application.CallStatusCallbackUrl, "https://b.com");
- Assert.Equal(r.Application.CallInitiatedMethod, "GET");
- Assert.Equal(r.Application.CallStatusMethod, "GET");
- Assert.Equal(r.Application.CallbackCreds.UserId, "login123");
+ Assert.Equal("d3e418e9-1833-49c1-b6c7-ca1700f79586", r.Application.ApplicationId);
+ Assert.Equal("Voice-V2", r.Application.ServiceType);
+ Assert.Equal("v1", r.Application.AppName);
+ Assert.Equal("https://a.com", r.Application.CallInitiatedCallbackUrl);
+ Assert.Equal("https://b.com", r.Application.CallStatusCallbackUrl);
+ Assert.Equal("GET", r.Application.CallInitiatedMethod);
+ Assert.Equal("GET", r.Application.CallStatusMethod);
+ Assert.Equal("login123", r.Application.CallbackCreds.UserId);
}
@@ -374,11 +374,11 @@ public void TestGetAssociatesSipPeers()
Assert.NotNull(r.AssociatedSipPeers);
- Assert.Equal(r.AssociatedSipPeers.Length, 2);
- Assert.Equal(r.AssociatedSipPeers[0].SiteId, "13651");
- Assert.Equal(r.AssociatedSipPeers[0].SiteName, "Prod Sub-account");
- Assert.Equal(r.AssociatedSipPeers[0].PeerId, "540341");
- Assert.Equal(r.AssociatedSipPeers[0].PeerName, "Prod");
+ Assert.Equal(2, r.AssociatedSipPeers.Length);
+ Assert.Equal("13651", r.AssociatedSipPeers[0].SiteId);
+ Assert.Equal("Prod Sub-account", r.AssociatedSipPeers[0].SiteName);
+ Assert.Equal("540341", r.AssociatedSipPeers[0].PeerId);
+ Assert.Equal("Prod", r.AssociatedSipPeers[0].PeerName);
@@ -412,7 +412,7 @@ public void TestGetAssociatesSipPeers400()
{
if (ex is BandwidthIrisException)
{
- Assert.Equal(ex.Message, " Current 1 Account have no Catapult association ");
+ Assert.Equal(" Current 1 Account have no Catapult association ", ex.Message);
return true;
}
return true;
@@ -449,7 +449,7 @@ public void TestGetAssociatesSipPeers404()
{
if (ex is BandwidthIrisException)
{
- Assert.Equal(ex.Message, " Application with id 'non_existing' not found ");
+ Assert.Equal(" Application with id 'non_existing' not found ", ex.Message);
return true;
}
return true;
diff --git a/Bandwidth.Iris.Tests/Models/CoveredRateCenterTests.cs b/Bandwidth.Iris.Tests/Models/CoveredRateCenterTests.cs
index 461955a..3dce753 100644
--- a/Bandwidth.Iris.Tests/Models/CoveredRateCenterTests.cs
+++ b/Bandwidth.Iris.Tests/Models/CoveredRateCenterTests.cs
@@ -31,7 +31,7 @@ public void ListTest()
{"state", "NC"}
}).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, result.Length);
+ Assert.Single(result);
Assert.Equal("ACME", result[0].Abbreviation);
Assert.Equal("ACME", result[0].Name);
}
@@ -52,7 +52,7 @@ public void ListWithDefaultClientTest()
{"state", "NC"}
}).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, result.Length);
+ Assert.Single(result);
Assert.Equal("ACME", result[0].Abbreviation);
Assert.Equal("ACME", result[0].Name);
}
diff --git a/Bandwidth.Iris.Tests/Models/CsrTest.cs b/Bandwidth.Iris.Tests/Models/CsrTest.cs
index 4774e6f..482a1e0 100644
--- a/Bandwidth.Iris.Tests/Models/CsrTest.cs
+++ b/Bandwidth.Iris.Tests/Models/CsrTest.cs
@@ -6,7 +6,7 @@
namespace Bandwidth.Iris.Tests.Models
{
-
+
public class CsrTest
{
[Fact]
@@ -14,7 +14,7 @@ public void TestCreate()
{
var csr = new Csr
{
- AccountId = "accountId"
+ AccountId = "accountId"
};
using (var server = new HttpServer(new RequestHandler
@@ -28,30 +28,30 @@ public void TestCreate()
var result = Csr.Create(client, csr).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.CustomerOrderId, "TEST BWDB-6506");
- Assert.Equal(result.LastModifiedBy, "systemUser");
- Assert.Equal(result.OrderCreateDate, "2020-01-13T21:14:35Z");
- Assert.Equal(result.AccountId, "14");
- Assert.Equal(result.OrderId, "5c3b8240-52b5-45a5-8d7d-42a71ebcd1ba");
- Assert.Equal(result.LastModifiedDate, "2020-01-13T16:51:21.920Z");
- Assert.Equal(result.Status, "COMPLETE");
- Assert.Equal(result.AccountNumber, "987654321");
- Assert.Equal(result.AccountTelephoneNumber, "9196194444");
- Assert.Equal(result.EndUserName, "bandwidthGuy");
- Assert.Equal(result.AuthorizingUserName, "importantAuthGuy");
- Assert.Equal(result.CustomerCode, "123");
- Assert.Equal(result.EndUserPIN, "12345");
- Assert.Equal(result.EndUserPassword, "enduserpassword123");
- Assert.Equal(result.AddressLine1, "900 Main Campus Dr");
- Assert.Equal(result.City, "Raleigh");
- Assert.Equal(result.State, "NC");
- Assert.Equal(result.ZIPCode, "27612");
- Assert.Equal(result.TypeOfService, "residential");
- Assert.Equal(result.CsrData.AccountNumber, "123456789");
- Assert.Equal(result.CsrData.CustomerName, "JOHN SMITH");
- Assert.Equal(result.CsrData.WorkingTelephoneNumber, "9196191156");
- Assert.Equal(result.CsrData.WorkingTelephoneNumbersOnAccount.Length, 1);
- Assert.Equal(result.CsrData.WorkingTelephoneNumbersOnAccount[0], "9196191156");
+ Assert.Equal("TEST BWDB-6506", result.CustomerOrderId);
+ Assert.Equal("systemUser", result.LastModifiedBy);
+ Assert.Equal("2020-01-13T21:14:35Z", result.OrderCreateDate);
+ Assert.Equal("14", result.AccountId);
+ Assert.Equal("5c3b8240-52b5-45a5-8d7d-42a71ebcd1ba", result.OrderId);
+ Assert.Equal("2020-01-13T16:51:21.920Z", result.LastModifiedDate);
+ Assert.Equal("COMPLETE", result.Status);
+ Assert.Equal("987654321", result.AccountNumber);
+ Assert.Equal("9196194444", result.AccountTelephoneNumber);
+ Assert.Equal("bandwidthGuy", result.EndUserName);
+ Assert.Equal("importantAuthGuy", result.AuthorizingUserName);
+ Assert.Equal("123", result.CustomerCode);
+ Assert.Equal("12345", result.EndUserPIN);
+ Assert.Equal("enduserpassword123", result.EndUserPassword);
+ Assert.Equal("900 Main Campus Dr", result.AddressLine1);
+ Assert.Equal("Raleigh", result.City);
+ Assert.Equal("NC", result.State);
+ Assert.Equal("27612", result.ZIPCode);
+ Assert.Equal("residential", result.TypeOfService);
+ Assert.Equal("123456789", result.CsrData.AccountNumber);
+ Assert.Equal("JOHN SMITH", result.CsrData.CustomerName);
+ Assert.Equal("9196191156", result.CsrData.WorkingTelephoneNumber);
+ Assert.Single(result.CsrData.WorkingTelephoneNumbersOnAccount);
+ Assert.Equal("9196191156", result.CsrData.WorkingTelephoneNumbersOnAccount[0]);
Assert.NotNull(result.CsrData.ServiceAddress);
@@ -75,36 +75,36 @@ public void TestGet()
var result = Csr.Get(client, orderId).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.CustomerOrderId, "TEST BWDB-6506");
- Assert.Equal(result.LastModifiedBy, "systemUser");
- Assert.Equal(result.OrderCreateDate, "2020-01-13T21:14:35Z");
- Assert.Equal(result.AccountId, "14");
- Assert.Equal(result.OrderId, "5c3b8240-52b5-45a5-8d7d-42a71ebcd1ba");
- Assert.Equal(result.LastModifiedDate, "2020-01-13T16:51:21.920Z");
- Assert.Equal(result.Status, "COMPLETE");
- Assert.Equal(result.AccountNumber, "987654321");
- Assert.Equal(result.AccountTelephoneNumber, "9196194444");
- Assert.Equal(result.EndUserName, "bandwidthGuy");
- Assert.Equal(result.AuthorizingUserName, "importantAuthGuy");
- Assert.Equal(result.CustomerCode, "123");
- Assert.Equal(result.EndUserPIN, "12345");
- Assert.Equal(result.EndUserPassword, "enduserpassword123");
- Assert.Equal(result.AddressLine1, "900 Main Campus Dr");
- Assert.Equal(result.City, "Raleigh");
- Assert.Equal(result.State, "NC");
- Assert.Equal(result.ZIPCode, "27612");
- Assert.Equal(result.TypeOfService, "residential");
- Assert.Equal(result.CsrData.AccountNumber, "123456789");
- Assert.Equal(result.CsrData.CustomerName, "JOHN SMITH");
- Assert.Equal(result.CsrData.WorkingTelephoneNumber, "9196191156");
- Assert.Equal(result.CsrData.WorkingTelephoneNumbersOnAccount.Length, 1);
- Assert.Equal(result.CsrData.WorkingTelephoneNumbersOnAccount[0], "9196191156");
+ Assert.Equal("TEST BWDB-6506", result.CustomerOrderId);
+ Assert.Equal("systemUser", result.LastModifiedBy);
+ Assert.Equal("2020-01-13T21:14:35Z", result.OrderCreateDate);
+ Assert.Equal("14", result.AccountId);
+ Assert.Equal("5c3b8240-52b5-45a5-8d7d-42a71ebcd1ba", result.OrderId);
+ Assert.Equal("2020-01-13T16:51:21.920Z", result.LastModifiedDate);
+ Assert.Equal("COMPLETE", result.Status);
+ Assert.Equal("987654321", result.AccountNumber);
+ Assert.Equal("9196194444", result.AccountTelephoneNumber);
+ Assert.Equal("bandwidthGuy", result.EndUserName);
+ Assert.Equal("importantAuthGuy", result.AuthorizingUserName);
+ Assert.Equal("123", result.CustomerCode);
+ Assert.Equal("12345", result.EndUserPIN);
+ Assert.Equal("enduserpassword123", result.EndUserPassword);
+ Assert.Equal("900 Main Campus Dr", result.AddressLine1);
+ Assert.Equal("Raleigh", result.City);
+ Assert.Equal("NC", result.State);
+ Assert.Equal("27612", result.ZIPCode);
+ Assert.Equal("residential", result.TypeOfService);
+ Assert.Equal("123456789", result.CsrData.AccountNumber);
+ Assert.Equal("JOHN SMITH", result.CsrData.CustomerName);
+ Assert.Equal("9196191156", result.CsrData.WorkingTelephoneNumber);
+ Assert.Single(result.CsrData.WorkingTelephoneNumbersOnAccount);
+ Assert.Equal("9196191156", result.CsrData.WorkingTelephoneNumbersOnAccount[0]);
Assert.NotNull(result.CsrData.ServiceAddress);
}
}
-
+
[Fact]
public void TestReplace()
{
@@ -126,30 +126,30 @@ public void TestReplace()
var result = Csr.Replace(client, orderId, csr).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.CustomerOrderId, "TEST BWDB-6506");
- Assert.Equal(result.LastModifiedBy, "systemUser");
- Assert.Equal(result.OrderCreateDate, "2020-01-13T21:14:35Z");
- Assert.Equal(result.AccountId, "14");
- Assert.Equal(result.OrderId, "5c3b8240-52b5-45a5-8d7d-42a71ebcd1ba");
- Assert.Equal(result.LastModifiedDate, "2020-01-13T16:51:21.920Z");
- Assert.Equal(result.Status, "COMPLETE");
- Assert.Equal(result.AccountNumber, "987654321");
- Assert.Equal(result.AccountTelephoneNumber, "9196194444");
- Assert.Equal(result.EndUserName, "bandwidthGuy");
- Assert.Equal(result.AuthorizingUserName, "importantAuthGuy");
- Assert.Equal(result.CustomerCode, "123");
- Assert.Equal(result.EndUserPIN, "12345");
- Assert.Equal(result.EndUserPassword, "enduserpassword123");
- Assert.Equal(result.AddressLine1, "900 Main Campus Dr");
- Assert.Equal(result.City, "Raleigh");
- Assert.Equal(result.State, "NC");
- Assert.Equal(result.ZIPCode, "27612");
- Assert.Equal(result.TypeOfService, "residential");
- Assert.Equal(result.CsrData.AccountNumber, "123456789");
- Assert.Equal(result.CsrData.CustomerName, "JOHN SMITH");
- Assert.Equal(result.CsrData.WorkingTelephoneNumber, "9196191156");
- Assert.Equal(result.CsrData.WorkingTelephoneNumbersOnAccount.Length, 1);
- Assert.Equal(result.CsrData.WorkingTelephoneNumbersOnAccount[0], "9196191156");
+ Assert.Equal("TEST BWDB-6506", result.CustomerOrderId);
+ Assert.Equal("systemUser", result.LastModifiedBy);
+ Assert.Equal("2020-01-13T21:14:35Z", result.OrderCreateDate);
+ Assert.Equal("14", result.AccountId);
+ Assert.Equal("5c3b8240-52b5-45a5-8d7d-42a71ebcd1ba", result.OrderId);
+ Assert.Equal("2020-01-13T16:51:21.920Z", result.LastModifiedDate);
+ Assert.Equal("COMPLETE", result.Status);
+ Assert.Equal("987654321", result.AccountNumber);
+ Assert.Equal("9196194444", result.AccountTelephoneNumber);
+ Assert.Equal("bandwidthGuy", result.EndUserName);
+ Assert.Equal("importantAuthGuy", result.AuthorizingUserName);
+ Assert.Equal("123", result.CustomerCode);
+ Assert.Equal("12345", result.EndUserPIN);
+ Assert.Equal("enduserpassword123", result.EndUserPassword);
+ Assert.Equal("900 Main Campus Dr", result.AddressLine1);
+ Assert.Equal("Raleigh", result.City);
+ Assert.Equal("NC", result.State);
+ Assert.Equal("27612", result.ZIPCode);
+ Assert.Equal("residential", result.TypeOfService);
+ Assert.Equal("123456789", result.CsrData.AccountNumber);
+ Assert.Equal("JOHN SMITH", result.CsrData.CustomerName);
+ Assert.Equal("9196191156", result.CsrData.WorkingTelephoneNumber);
+ Assert.Single(result.CsrData.WorkingTelephoneNumbersOnAccount);
+ Assert.Equal("9196191156", result.CsrData.WorkingTelephoneNumbersOnAccount[0]);
Assert.NotNull(result.CsrData.ServiceAddress);
@@ -175,11 +175,11 @@ public void TestListNotes()
Assert.NotNull(result.List);
- Assert.Equal(result.List.Length, 2);
+ Assert.Equal(2, result.List.Length);
- Assert.Equal(result.List[0].Description, "This is a test note");
- Assert.Equal(result.List[0].Id, "87037");
- Assert.Equal(result.List[0].UserId, "jbm");
+ Assert.Equal("This is a test note", result.List[0].Description);
+ Assert.Equal("87037", result.List[0].Id);
+ Assert.Equal("jbm", result.List[0].UserId);
Assert.Equal(result.List[0].LastDateModifier, DateTime.Parse("2014-11-16T04:01:10.000"));
}
@@ -203,7 +203,7 @@ public void TestCreateNote()
{
var client = Helper.CreateClient();
Csr.CreateNote(client, orderId, note).Wait();
- if (server.Error != null) throw server.Error;
+ if (server.Error != null) throw server.Error;
}
}
diff --git a/Bandwidth.Iris.Tests/Models/DisconnectTests.cs b/Bandwidth.Iris.Tests/Models/DisconnectTests.cs
index afd8800..95ecab8 100644
--- a/Bandwidth.Iris.Tests/Models/DisconnectTests.cs
+++ b/Bandwidth.Iris.Tests/Models/DisconnectTests.cs
@@ -42,6 +42,7 @@ public void DisconnectNumbersTest()
}
}
+ [Fact]
public void DisconnectNumbersWithDefaultClientTest()
{
var data = new DisconnectTelephoneNumberOrder
diff --git a/Bandwidth.Iris.Tests/Models/EmergencyNotificationTests.cs b/Bandwidth.Iris.Tests/Models/EmergencyNotificationTests.cs
index bf9f7ef..e4f90e0 100644
--- a/Bandwidth.Iris.Tests/Models/EmergencyNotificationTests.cs
+++ b/Bandwidth.Iris.Tests/Models/EmergencyNotificationTests.cs
@@ -323,7 +323,7 @@ public void TestGetEndpointOrders()
Assert.NotNull(addedAssoc);
Assert.NotNull(addedAssoc.AddedEepToEngAssociations);
- Assert.Equal(1, addedAssoc.AddedEepToEngAssociations.Length);
+ Assert.Single(addedAssoc.AddedEepToEngAssociations);
Assert.Equal(2, addedAssoc.AddedEepToEngAssociations[0].EepTns.Length);
Assert.Equal(2, addedAssoc.AddedEepToEngAssociations[0].EepAeuiIds.Length);
@@ -355,7 +355,7 @@ public void TestListEndpointOrders()
Assert.NotNull(result.Links);
Assert.NotNull(result.EmergencyNotificationEndpointOrders);
- Assert.Equal(1, result.EmergencyNotificationEndpointOrders.Length);
+ Assert.Single(result.EmergencyNotificationEndpointOrders);
}
}
diff --git a/Bandwidth.Iris.Tests/Models/HostTests.cs b/Bandwidth.Iris.Tests/Models/HostTests.cs
index 5d75ed0..764114b 100644
--- a/Bandwidth.Iris.Tests/Models/HostTests.cs
+++ b/Bandwidth.Iris.Tests/Models/HostTests.cs
@@ -28,8 +28,8 @@ public void ListTest()
var client = Helper.CreateClient();
var result = Host.List(client).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, result.Length);
- Assert.Equal(1, result[0].SipPeerHosts[0].SmsHosts.Length);
+ Assert.Single(result);
+ Assert.Single(result[0].SipPeerHosts[0].SmsHosts);
}
}
[Fact]
@@ -44,8 +44,8 @@ public void ListWithDefaultClientTest()
{
var result = Host.List().Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, result.Length);
- Assert.Equal(1, result[0].SipPeerHosts[0].SmsHosts.Length);
+ Assert.Single(result);
+ Assert.Single(result[0].SipPeerHosts[0].SmsHosts);
}
}
diff --git a/Bandwidth.Iris.Tests/Models/ImportTnCheckerTests.cs b/Bandwidth.Iris.Tests/Models/ImportTnCheckerTests.cs
index 7b15d4b..dd8c0f7 100644
--- a/Bandwidth.Iris.Tests/Models/ImportTnCheckerTests.cs
+++ b/Bandwidth.Iris.Tests/Models/ImportTnCheckerTests.cs
@@ -37,12 +37,12 @@ public void TestCreate()
var result = ImportTnChecker.Create(client, order).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.ImportTnCheckerPayload.TelephoneNumbers.Length, 1);
- Assert.Equal(result.ImportTnCheckerPayload.ImportTnErrors.Length, 1);
+ Assert.Single(result.ImportTnCheckerPayload.TelephoneNumbers);
+ Assert.Single(result.ImportTnCheckerPayload.ImportTnErrors);
- Assert.Equal(result.ImportTnCheckerPayload.ImportTnErrors[0].Code, 19006);
- Assert.Equal(result.ImportTnCheckerPayload.ImportTnErrors[0].Description, "Bandwidth numbers cannot be imported by this account at this time.");
- Assert.Equal(result.ImportTnCheckerPayload.ImportTnErrors[0].TelephoneNumbers.Length, 2);
+ Assert.Equal(19006, result.ImportTnCheckerPayload.ImportTnErrors[0].Code);
+ Assert.Equal("Bandwidth numbers cannot be imported by this account at this time.", result.ImportTnCheckerPayload.ImportTnErrors[0].Description);
+ Assert.Equal(2, result.ImportTnCheckerPayload.ImportTnErrors[0].TelephoneNumbers.Length);
}
}
diff --git a/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs b/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs
index 8e5981c..344de33 100644
--- a/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs
+++ b/Bandwidth.Iris.Tests/Models/ImportTnOrderTests.cs
@@ -38,19 +38,19 @@ public void TestImportTnOrderCreate()
var result = ImportTnOrder.Create(client, order).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.ImportTnOrder.CustomerOrderId, "SJM000001");
- Assert.Equal(result.ImportTnOrder.OrderCreateDate, "2018-01-20T02:59:54.000Z");
- Assert.Equal(result.ImportTnOrder.AccountId, "9900012");
- Assert.Equal(result.ImportTnOrder.CreatedByUser, "smckinnon");
- Assert.Equal(result.ImportTnOrder.OrderId, "b05de7e6-0cab-4c83-81bb-9379cba8efd0");
- Assert.Equal(result.ImportTnOrder.LastModifiedDate, "2018-01-20T02:59:54.000Z");
- Assert.Equal(result.ImportTnOrder.SiteId, 202);
- Assert.Equal(result.ImportTnOrder.SipPeerId, 520565);
- Assert.Equal(result.ImportTnOrder.ProcessingStatus, "PROCESSING");
+ Assert.Equal("SJM000001", result.ImportTnOrder.CustomerOrderId);
+ Assert.Equal("2018-01-20T02:59:54.000Z", result.ImportTnOrder.OrderCreateDate);
+ Assert.Equal("9900012", result.ImportTnOrder.AccountId);
+ Assert.Equal("smckinnon", result.ImportTnOrder.CreatedByUser);
+ Assert.Equal("b05de7e6-0cab-4c83-81bb-9379cba8efd0", result.ImportTnOrder.OrderId);
+ Assert.Equal("2018-01-20T02:59:54.000Z", result.ImportTnOrder.LastModifiedDate);
+ Assert.Equal(202, result.ImportTnOrder.SiteId);
+ Assert.Equal(520565, result.ImportTnOrder.SipPeerId);
+ Assert.Equal("PROCESSING", result.ImportTnOrder.ProcessingStatus);
Assert.NotNull(result.ImportTnOrder.Subscriber);
- Assert.Equal(result.ImportTnOrder.TelephoneNumbers.Length, 4);
+ Assert.Equal(4, result.ImportTnOrder.TelephoneNumbers.Length);
}
}
@@ -77,19 +77,19 @@ public void TestImportTnOrderGet()
var result = ImportTnOrder.Get(client, order.OrderId).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.CustomerOrderId, "SJM000001");
- Assert.Equal(result.OrderCreateDate, "2018-01-20T02:59:54.000Z");
- Assert.Equal(result.AccountId, "9900012");
- Assert.Equal(result.CreatedByUser, "smckinnon");
- Assert.Equal(result.OrderId, "b05de7e6-0cab-4c83-81bb-9379cba8efd0");
- Assert.Equal(result.LastModifiedDate, "2018-01-20T02:59:54.000Z");
- Assert.Equal(result.SiteId, 202);
- Assert.Equal(result.SipPeerId, 520565);
- Assert.Equal(result.ProcessingStatus, "PROCESSING");
+ Assert.Equal("SJM000001", result.CustomerOrderId);
+ Assert.Equal("2018-01-20T02:59:54.000Z", result.OrderCreateDate);
+ Assert.Equal("9900012", result.AccountId);
+ Assert.Equal("smckinnon", result.CreatedByUser);
+ Assert.Equal("b05de7e6-0cab-4c83-81bb-9379cba8efd0", result.OrderId);
+ Assert.Equal("2018-01-20T02:59:54.000Z", result.LastModifiedDate);
+ Assert.Equal(202, result.SiteId);
+ Assert.Equal(520565, result.SipPeerId);
+ Assert.Equal("PROCESSING", result.ProcessingStatus);
Assert.NotNull(result.Subscriber);
- Assert.Equal(result.TelephoneNumbers.Length, 4);
+ Assert.Equal(4, result.TelephoneNumbers.Length);
}
}
@@ -116,17 +116,17 @@ public void TestImportTnOrderList()
var result = ImportTnOrder.List(client, new Dictionary { { "accountId", "1" } }).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.TotalCount, 14);
- Assert.Equal(result.ImportTnOrderSummarys.Length, 14);
- Assert.Equal(result.ImportTnOrderSummarys[0].accountId, 9900778);
- Assert.Equal(result.ImportTnOrderSummarys[0].CountOfTNs, 1);
- Assert.Equal(result.ImportTnOrderSummarys[0].CustomerOrderId, "id");
- Assert.Equal(result.ImportTnOrderSummarys[0].userId, "jmulford-api");
- Assert.Equal(result.ImportTnOrderSummarys[0].lastModifiedDate, "2020-02-04T14:09:08.937Z");
- Assert.Equal(result.ImportTnOrderSummarys[0].OrderDate, "2020-02-04T14:09:07.824Z");
- Assert.Equal(result.ImportTnOrderSummarys[0].OrderType, "import_tn_orders");
- Assert.Equal(result.ImportTnOrderSummarys[0].OrderStatus, "FAILED");
- Assert.Equal(result.ImportTnOrderSummarys[0].OrderId, "fbd17609-be44-48e7-a301-90bd6cf42248");
+ Assert.Equal(14, result.TotalCount);
+ Assert.Equal(14, result.ImportTnOrderSummarys.Length);
+ Assert.Equal(9900778, result.ImportTnOrderSummarys[0].accountId);
+ Assert.Equal(1, result.ImportTnOrderSummarys[0].CountOfTNs);
+ Assert.Equal("id", result.ImportTnOrderSummarys[0].CustomerOrderId);
+ Assert.Equal("jmulford-api", result.ImportTnOrderSummarys[0].userId);
+ Assert.Equal("2020-02-04T14:09:08.937Z", result.ImportTnOrderSummarys[0].lastModifiedDate);
+ Assert.Equal("2020-02-04T14:09:07.824Z", result.ImportTnOrderSummarys[0].OrderDate);
+ Assert.Equal("import_tn_orders", result.ImportTnOrderSummarys[0].OrderType);
+ Assert.Equal("FAILED", result.ImportTnOrderSummarys[0].OrderStatus);
+ Assert.Equal("fbd17609-be44-48e7-a301-90bd6cf42248", result.ImportTnOrderSummarys[0].OrderId);
}
}
@@ -153,11 +153,11 @@ public void TestImportTnOrderHistory()
var result = ImportTnOrder.GetHistory(client, order.OrderId).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.Items.Length, 2);
+ Assert.Equal(2, result.Items.Length);
Assert.Equal(result.Items[0].OrderDate, DateTime.Parse("2020-02-04T14:09:07.824"));
- Assert.Equal(result.Items[0].Note, "Import TN order has been received by the system.");
- Assert.Equal(result.Items[0].Author, "jmulford-api");
- Assert.Equal(result.Items[0].Status, "received");
+ Assert.Equal("Import TN order has been received by the system.", result.Items[0].Note);
+ Assert.Equal("jmulford-api", result.Items[0].Author);
+ Assert.Equal("received", result.Items[0].Status);
}
}
@@ -184,11 +184,11 @@ public void TestImportTnOrderListLoasFiles()
var result = ImportTnOrder.ListLoasFiles(client, order.OrderId).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.FileCount, 2);
- Assert.Equal(result.FileNames.Length, 2);
- Assert.Equal(result.FileNames[0], "803f3cc5-beae-469e-bd65-e9891ccdffb9-1092874634747.pdf");
- Assert.Equal(result.ResultCode, "0");
- Assert.Equal(result.ResultMessage, "LOA file list successfully returned");
+ Assert.Equal(2, result.FileCount);
+ Assert.Equal(2, result.FileNames.Length);
+ Assert.Equal("803f3cc5-beae-469e-bd65-e9891ccdffb9-1092874634747.pdf", result.FileNames[0]);
+ Assert.Equal("0", result.ResultCode);
+ Assert.Equal("LOA file list successfully returned", result.ResultMessage);
}
diff --git a/Bandwidth.Iris.Tests/Models/LineOptionTests.cs b/Bandwidth.Iris.Tests/Models/LineOptionTests.cs
index 1261167..d63d510 100644
--- a/Bandwidth.Iris.Tests/Models/LineOptionTests.cs
+++ b/Bandwidth.Iris.Tests/Models/LineOptionTests.cs
@@ -38,7 +38,7 @@ public void CreateTest()
var client = Helper.CreateClient();
var i = LineOptionOrder.Create(client, item).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, i.Length);
+ Assert.Single(i);
Assert.Equal("2013223685", i[0]);
}
@@ -66,7 +66,7 @@ public void CreateWithDefaultClientTest()
{
var i = LineOptionOrder.Create(item).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, i.Length);
+ Assert.Single(i);
Assert.Equal("2013223685", i[0]);
}
}
diff --git a/Bandwidth.Iris.Tests/Models/OrderTests.cs b/Bandwidth.Iris.Tests/Models/OrderTests.cs
index 0efe803..07c7646 100644
--- a/Bandwidth.Iris.Tests/Models/OrderTests.cs
+++ b/Bandwidth.Iris.Tests/Models/OrderTests.cs
@@ -189,19 +189,19 @@ public void ListTest()
Assert.Equal("2013-12-20T06", result.Orders.OrderDetails[0].LastModifiedDate);
Assert.Equal("2013-12-20T06", result.Orders.OrderDetails[0].OrderDate);
Assert.Equal("bwc_user", result.Orders.OrderDetails[0].UserId);
- Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.States.Count);
+ Assert.Single(result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.States);
Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.States[0].Count);
Assert.Equal("VA", result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.States[0].State);
- Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.RateCenters.Count);
+ Assert.Single(result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.RateCenters);
Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.RateCenters[0].Count);
Assert.Equal("LADYSMITH", result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.RateCenters[0].RateCenter);
- Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Cities.Count);
+ Assert.Single(result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Cities);
Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Cities[0].Count);
Assert.Equal("LADYSMITH", result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Cities[0].City);
- Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Tiers.Count);
+ Assert.Single(result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Tiers);
Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Tiers[0].Count);
Assert.Equal(0, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Tiers[0].Tier);
- Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Vendors.Count);
+ Assert.Single(result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Vendors);
Assert.Equal(1, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Vendors[0].Count);
Assert.Equal(49, result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Vendors[0].VendorId);
Assert.Equal("Bandwidth CLEC", result.Orders.OrderDetails[0].TelephoneNumberDetailsWithCount.Vendors[0].VendorName);
@@ -334,7 +334,7 @@ public void GetAreaCodesTest()
order.SetClient(client);
var list = order.GetAreaCodes().Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, list.Length);
+ Assert.Single(list);
Assert.Equal("888", list[0].Code);
}
}
@@ -354,7 +354,7 @@ public void GetNpaNxxTest()
order.SetClient(client);
var list = order.GetNpaNxx().Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, list.Length);
+ Assert.Single(list);
}
}
@@ -373,7 +373,7 @@ public void GetTotalsTest()
order.SetClient(client);
var list = order.GetTotals().Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, list.Length);
+ Assert.Single(list);
}
}
diff --git a/Bandwidth.Iris.Tests/Models/PortInTests.cs b/Bandwidth.Iris.Tests/Models/PortInTests.cs
index 6f71611..72a1f0f 100644
--- a/Bandwidth.Iris.Tests/Models/PortInTests.cs
+++ b/Bandwidth.Iris.Tests/Models/PortInTests.cs
@@ -502,7 +502,7 @@ public void GetPortInTest()
Assert.Equal(PortType.AUTOMATED, r.PortType);
//TnAttributes
- Assert.Equal(1, r.TnAttributes.Length);
+ Assert.Single(r.TnAttributes);
Assert.Equal("Protected", r.TnAttributes[0]);
//Suscriber
@@ -554,7 +554,7 @@ public void LnpOrderResponseTest()
Assert.Equal("Telephone number is already being processed on another order", lnpOrderResponse.Errors[1].Description);
//TnAttributes
- Assert.Equal(1, lnpOrderResponse.TnAttributes.Length);
+ Assert.Single(lnpOrderResponse.TnAttributes);
Assert.Equal("Protected", lnpOrderResponse.TnAttributes[0]);
//Suscriber
diff --git a/Bandwidth.Iris.Tests/Models/RemoveImportedTnOrderTests.cs b/Bandwidth.Iris.Tests/Models/RemoveImportedTnOrderTests.cs
index ffd77d6..24f9105 100644
--- a/Bandwidth.Iris.Tests/Models/RemoveImportedTnOrderTests.cs
+++ b/Bandwidth.Iris.Tests/Models/RemoveImportedTnOrderTests.cs
@@ -35,15 +35,15 @@ public void TestCreate()
var result = RemoveImportedTnOrder.Create(client, order).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.RemoveImportedTnOrder.CustomerOrderId, "SJM000001");
- Assert.Equal(result.RemoveImportedTnOrder.OrderCreateDate, "2018-01-20T02:59:54.000Z");
- Assert.Equal(result.RemoveImportedTnOrder.AccountId, "9900012");
- Assert.Equal(result.RemoveImportedTnOrder.CreatedByUser, "smckinnon");
- Assert.Equal(result.RemoveImportedTnOrder.OrderId, "b05de7e6-0cab-4c83-81bb-9379cba8efd0");
- Assert.Equal(result.RemoveImportedTnOrder.LastModifiedDate, "2018-01-20T02:59:54.000Z");
- Assert.Equal(result.RemoveImportedTnOrder.ProcessingStatus, "PROCESSING");
+ Assert.Equal("SJM000001", result.RemoveImportedTnOrder.CustomerOrderId);
+ Assert.Equal("2018-01-20T02:59:54.000Z", result.RemoveImportedTnOrder.OrderCreateDate);
+ Assert.Equal("9900012", result.RemoveImportedTnOrder.AccountId);
+ Assert.Equal("smckinnon", result.RemoveImportedTnOrder.CreatedByUser);
+ Assert.Equal("b05de7e6-0cab-4c83-81bb-9379cba8efd0", result.RemoveImportedTnOrder.OrderId);
+ Assert.Equal("2018-01-20T02:59:54.000Z", result.RemoveImportedTnOrder.LastModifiedDate);
+ Assert.Equal("PROCESSING", result.RemoveImportedTnOrder.ProcessingStatus);
- Assert.Equal(result.RemoveImportedTnOrder.TelephoneNumbers.Length, 4);
+ Assert.Equal(4, result.RemoveImportedTnOrder.TelephoneNumbers.Length);
}
@@ -68,16 +68,16 @@ public void TestList()
var result = RemoveImportedTnOrder.List(client, null).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.TotalCount, 7);
- Assert.Equal(result.Items.Length, 7);
+ Assert.Equal(7, result.TotalCount);
+ Assert.Equal(7, result.Items.Length);
- Assert.Equal(result.Items[0].CustomerOrderId, "custom string");
- Assert.Equal(result.Items[0].userId, "jmulford-api");
- Assert.Equal(result.Items[0].lastModifiedDate, "2020-02-03T18:08:44.256Z");
- Assert.Equal(result.Items[0].OrderDate, "2020-02-03T18:08:44.199Z");
- Assert.Equal(result.Items[0].OrderType, "remove_imported_tn_orders");
- Assert.Equal(result.Items[0].OrderStatus, "FAILED");
- Assert.Equal(result.Items[0].OrderId, "5bb3b642-cbbb-4438-9a44-56069550d603");
+ Assert.Equal("custom string", result.Items[0].CustomerOrderId);
+ Assert.Equal("jmulford-api", result.Items[0].userId);
+ Assert.Equal("2020-02-03T18:08:44.256Z", result.Items[0].lastModifiedDate);
+ Assert.Equal("2020-02-03T18:08:44.199Z", result.Items[0].OrderDate);
+ Assert.Equal("remove_imported_tn_orders", result.Items[0].OrderType);
+ Assert.Equal("FAILED", result.Items[0].OrderStatus);
+ Assert.Equal("5bb3b642-cbbb-4438-9a44-56069550d603", result.Items[0].OrderId);
}
@@ -102,15 +102,15 @@ public void TestGet()
var result = RemoveImportedTnOrder.Get(client, order.OrderId).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(result.CustomerOrderId, "SJM000001");
- Assert.Equal(result.OrderCreateDate, "2018-01-20T02:59:54.000Z");
- Assert.Equal(result.AccountId, "9900012");
- Assert.Equal(result.CreatedByUser, "smckinnon");
- Assert.Equal(result.OrderId, "b05de7e6-0cab-4c83-81bb-9379cba8efd0");
- Assert.Equal(result.LastModifiedDate, "2018-01-20T02:59:54.000Z");
- Assert.Equal(result.ProcessingStatus, "PROCESSING");
+ Assert.Equal("SJM000001", result.CustomerOrderId);
+ Assert.Equal("2018-01-20T02:59:54.000Z", result.OrderCreateDate);
+ Assert.Equal("9900012", result.AccountId);
+ Assert.Equal("smckinnon", result.CreatedByUser);
+ Assert.Equal("b05de7e6-0cab-4c83-81bb-9379cba8efd0", result.OrderId);
+ Assert.Equal("2018-01-20T02:59:54.000Z", result.LastModifiedDate);
+ Assert.Equal("PROCESSING", result.ProcessingStatus);
- Assert.Equal(result.TelephoneNumbers.Length, 4);
+ Assert.Equal(4, result.TelephoneNumbers.Length);
}
diff --git a/Bandwidth.Iris.Tests/Models/SipPeerTests.cs b/Bandwidth.Iris.Tests/Models/SipPeerTests.cs
index d08b192..b92de1f 100644
--- a/Bandwidth.Iris.Tests/Models/SipPeerTests.cs
+++ b/Bandwidth.Iris.Tests/Models/SipPeerTests.cs
@@ -575,17 +575,17 @@ public void GetSMSSettingTest()
if (server.Error != null) throw server.Error;
Assert.NotNull(r.SipPeerSmsFeature);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.TollFree);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.ShortCode);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.TollFree);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.ShortCode);
Assert.Equal("DefaultOff", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.A2pLongCode);
Assert.Equal("SomeMessageClass", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.A2pMessageClass);
Assert.Equal("SomeCampaignId", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.A2pCampaignId);
Assert.Equal("SMPP", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Protocol);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone1);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone2);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone3);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone4);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone5);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone1);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone2);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone3);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone4);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone5);
Assert.Equal(2, r.SipPeerSmsFeature.SmppHosts.Length);
Assert.Equal("RECEIVER_ONLY", r.SipPeerSmsFeature.SmppHosts[0].ConnectionType);
@@ -631,17 +631,17 @@ public void SetSMSSettingTest()
if (server.Error != null) throw server.Error;
Assert.NotNull(r.SipPeerSmsFeature);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.TollFree);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.ShortCode);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.TollFree);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.ShortCode);
Assert.Equal("DefaultOff", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.A2pLongCode);
Assert.Equal("SomeMessageClass", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.A2pMessageClass);
Assert.Equal("SomeCampaignId", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.A2pCampaignId);
Assert.Equal("SMPP", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Protocol);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone1);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone2);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone3);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone4);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone5);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone1);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone2);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone3);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone4);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone5);
Assert.Equal(2, r.SipPeerSmsFeature.SmppHosts.Length);
Assert.Equal("RECEIVER_ONLY", r.SipPeerSmsFeature.SmppHosts[0].ConnectionType);
@@ -687,17 +687,17 @@ public void UpdateSMSSettingTest()
if (server.Error != null) throw server.Error;
Assert.NotNull(r.SipPeerSmsFeature);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.TollFree);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.ShortCode);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.TollFree);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.ShortCode);
Assert.Equal("DefaultOff", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.A2pLongCode);
Assert.Equal("SomeMessageClass", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.A2pMessageClass);
Assert.Equal("SomeCampaignId", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.A2pCampaignId);
Assert.Equal("SMPP", r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Protocol);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone1);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone2);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone3);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone4);
- Assert.Equal(true, r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone5);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone1);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone2);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone3);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone4);
+ Assert.True(r.SipPeerSmsFeature.SipPeerSmsFeatureSettings.Zone5);
Assert.Equal(2, r.SipPeerSmsFeature.SmppHosts.Length);
Assert.Equal("RECEIVER_ONLY", r.SipPeerSmsFeature.SmppHosts[0].ConnectionType);
@@ -750,7 +750,7 @@ public void GetMMSSettingTest()
Assert.NotNull(r.MmsFeature);
Assert.Equal("OFF", r.MmsFeature.Protocols.MM4.Tls);
- Assert.Equal(1, r.MmsFeature.Protocols.MM4.MmsMM4TermHosts.TermHosts.Length);
+ Assert.Single(r.MmsFeature.Protocols.MM4.MmsMM4TermHosts.TermHosts);
Assert.Equal("206.107.248.58", r.MmsFeature.Protocols.MM4.MmsMM4TermHosts.TermHosts[0].HostName);
Assert.Equal(2, r.MmsFeature.Protocols.MM4.MmsMM4OrigHosts.OrigHosts.Length);
@@ -794,7 +794,7 @@ public void SetMMSSettingTest()
Assert.NotNull(r.MmsFeature);
Assert.Equal("OFF", r.MmsFeature.Protocols.MM4.Tls);
- Assert.Equal(1, r.MmsFeature.Protocols.MM4.MmsMM4TermHosts.TermHosts.Length);
+ Assert.Single(r.MmsFeature.Protocols.MM4.MmsMM4TermHosts.TermHosts);
Assert.Equal("206.107.248.58", r.MmsFeature.Protocols.MM4.MmsMM4TermHosts.TermHosts[0].HostName);
Assert.Equal(2, r.MmsFeature.Protocols.MM4.MmsMM4OrigHosts.OrigHosts.Length);
diff --git a/Bandwidth.Iris.Tests/Models/SiteTests.cs b/Bandwidth.Iris.Tests/Models/SiteTests.cs
index 867a1fd..1bc4c91 100644
--- a/Bandwidth.Iris.Tests/Models/SiteTests.cs
+++ b/Bandwidth.Iris.Tests/Models/SiteTests.cs
@@ -169,7 +169,7 @@ public void ListWithXmlTest()
var client = Helper.CreateClient();
var result = Site.List(client).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, result.Length);
+ Assert.Single(result);
Assert.Equal("1", result[0].Id);
Assert.Equal("Test Site", result[0].Name);
Assert.Equal("A site description", result[0].Description);
@@ -573,7 +573,7 @@ public void BandwidthIrisExcpetionTest()
});
}
- Assert.Equal(true, error);
+ Assert.True(error);
}
diff --git a/Bandwidth.Iris.Tests/Models/SubscriptionTests.cs b/Bandwidth.Iris.Tests/Models/SubscriptionTests.cs
index c4ef807..3a48fcc 100644
--- a/Bandwidth.Iris.Tests/Models/SubscriptionTests.cs
+++ b/Bandwidth.Iris.Tests/Models/SubscriptionTests.cs
@@ -148,7 +148,7 @@ public void ListWithXmlTest()
var client = Helper.CreateClient();
var result = Subscription.List(client).Result;
if (server.Error != null) throw server.Error;
- Assert.Equal(1, result.Length);
+ Assert.Single(result);
Assert.Equal("1", result[0].Id);
Assert.Equal("orders", result[0].OrderType);
Assert.Equal("8684b1c8-7d41-4877-bfc2-6bd8ea4dc89f", result[0].OrderId);
diff --git a/Bandwidth.Iris.Tests/Models/TnTests.cs b/Bandwidth.Iris.Tests/Models/TnTests.cs
index 7e78c50..66c873a 100644
--- a/Bandwidth.Iris.Tests/Models/TnTests.cs
+++ b/Bandwidth.Iris.Tests/Models/TnTests.cs
@@ -37,6 +37,7 @@ public void GetTest()
}
}
+ [Fact(Skip = "throws a System.FormatException, most likely due to the serializer expecting a value in LastModifiedDate")]
public void GetTestWithNullDateTime()
{
using (var server = new HttpServer(new RequestHandler
diff --git a/Bandwidth.Iris/BandwidthIrisException.cs b/Bandwidth.Iris/BandwidthIrisException.cs
index 5f7f8f4..4077b94 100644
--- a/Bandwidth.Iris/BandwidthIrisException.cs
+++ b/Bandwidth.Iris/BandwidthIrisException.cs
@@ -4,13 +4,13 @@
namespace Bandwidth.Iris
{
- public sealed class BandwidthIrisException: Exception
+ public sealed class BandwidthIrisException : Exception
{
public string Code { get; private set; }
public HttpStatusCode HttpStatusCode { get; private set; }
public XDocument Body { get; private set; }
- public BandwidthIrisException(string code, string message, HttpStatusCode statusCode, XDocument body = null): base(message)
+ public BandwidthIrisException(string code, string message, HttpStatusCode statusCode, XDocument body = null) : base(message)
{
Code = code;
HttpStatusCode = statusCode;
diff --git a/Bandwidth.Iris/Client.cs b/Bandwidth.Iris/Client.cs
index ea55d36..e9f90fa 100644
--- a/Bandwidth.Iris/Client.cs
+++ b/Bandwidth.Iris/Client.cs
@@ -29,7 +29,7 @@ public static Client GetInstance(string accountId, string userName, string passw
return new Client(accountId, userName, password, apiEndpoint, apiVersion);
}
-
+
#if !PCL
public const string BandwidthApiAccountId = "BANDWIDTH_API_ACCOUNT_ID";
public const string BandwidthApiUserName = "BANDWIDTH_API_USERNAME";
@@ -47,7 +47,7 @@ public static Client GetInstance()
Environment.GetEnvironmentVariable(BandwidthApiVersion));
}
-
+
#endif
private Client(string accountId, string userName, string password, string apiEndpoint, string apiVersion)
{
@@ -121,7 +121,7 @@ internal async Task MakeGetRequest(string path, IDictionary
{
await CheckResponse(response);
}
- catch(Exception ex)
+ catch (Exception ex)
{
response.Dispose();
throw ex;
@@ -195,7 +195,7 @@ public async Task MakePatchRequest(string path, object data
HttpContent content = new StringContent(xml, Encoding.UTF8, "application/xml");
-
+
using (var client = CreateHttpClient())
{
@@ -227,7 +227,7 @@ public async Task MakePatchRequest(string path, object data
internal async Task MakePutRequest(string path, object data, bool disposeResponse = false)
{
-
+
using (var writer = new Utf8StringWriter())
{
var payload = "";
@@ -235,8 +235,8 @@ internal async Task MakePutRequest(string path, object data
{
payload = (string)data;
}
-
- else if ( !(typeof(Stream)).IsAssignableFrom(data.GetType()))
+
+ else if (!(typeof(Stream)).IsAssignableFrom(data.GetType()))
{
var serializer = new XmlSerializer(data.GetType());
serializer.Serialize(writer, data);
@@ -245,11 +245,12 @@ internal async Task MakePutRequest(string path, object data
using (var client = CreateHttpClient())
{
- if ( (typeof(Stream)).IsAssignableFrom(data.GetType()) ) {
+ if ((typeof(Stream)).IsAssignableFrom(data.GetType()))
+ {
return await client.PutAsync(FixPath(path), new StreamContent((Stream)data));
}
- var response = await client.PutAsync(FixPath(path), new StringContent(payload, Encoding.UTF8, "application/xml"));
+ var response = await client.PutAsync(FixPath(path), new StringContent(payload, Encoding.UTF8, "application/xml"));
try
{
await CheckResponse(response);
@@ -273,7 +274,7 @@ internal async Task SendData(string path, Stream stream, st
return await SendFileContent(path, mediaType, disposeResponse, new StreamContent(stream), method);
}
- internal async Task SendData(string path, byte[] buffer, string mediaType, string method = "POST",
+ internal async Task SendData(string path, byte[] buffer, string mediaType, string method = "POST",
bool disposeResponse = false)
{
if (buffer == null) throw new ArgumentNullException("buffer");
@@ -345,7 +346,7 @@ public async Task MakePutRequest(string path, object data)
public async Task MakePatchRequest(string path, object data)
{
- using (var response = await MakePatchRequest(path, data))
+ using (var response = await MakePatchRequest(path, data))
{
using (var stream = await response.Content.ReadAsStreamAsync())
{
@@ -411,9 +412,9 @@ private async Task CheckResponse(HttpResponseMessage response)
{
var exceptions =
(from item in doc.Descendants("Errors")
- select
- (Exception) new BandwidthIrisException(item.Element("Code").Value,
- item.Element("Description").Value, response.StatusCode)).ToArray();
+ select
+ (Exception)new BandwidthIrisException(item.Element("Code").Value,
+ item.Element("Description").Value, response.StatusCode)).ToArray();
if (exceptions.Length > 0)
{
throw new AggregateException(exceptions);
@@ -424,7 +425,7 @@ private async Task CheckResponse(HttpResponseMessage response)
else
{
code = error.Element("Code");
- description = error.Element("Description");
+ description = error.Element("Description");
}
}
if (code != null && description != null && !string.IsNullOrEmpty(code.Value) && code.Value != "0")
diff --git a/Bandwidth.Iris/Model/Account.cs b/Bandwidth.Iris/Model/Account.cs
index 18bde8e..5060c75 100644
--- a/Bandwidth.Iris/Model/Account.cs
+++ b/Bandwidth.Iris/Model/Account.cs
@@ -26,14 +26,14 @@ public string Id
public string CompanyName { get; set; }
public string AccountType { get; set; }
public string NenaId { get; set; }
-
+
[XmlArrayItem("Tier")]
public int[] Tiers { get; set; }
public bool ReservationAllowed { get; set; }
public bool LnpEnabled { get; set; }
public string AltSpid { get; set; }
-
+
[XmlElement("SPID")]
public string Spid { get; set; }
public string PortCarrierType { get; set; }
diff --git a/Bandwidth.Iris/Model/Application.cs b/Bandwidth.Iris/Model/Application.cs
index eca677b..081e8a7 100644
--- a/Bandwidth.Iris/Model/Application.cs
+++ b/Bandwidth.Iris/Model/Application.cs
@@ -46,7 +46,7 @@ public static Task Create(Application applicati
public async static Task Get(Client client, string applicationId)
{
- var item = await client.MakeGetRequest(client.ConcatAccountPath($"{applicatoinPath}/{applicationId}") );
+ var item = await client.MakeGetRequest(client.ConcatAccountPath($"{applicatoinPath}/{applicationId}"));
item.Client = client;
return item;
}
@@ -56,7 +56,7 @@ public static Task Get(string applicationId)
return Get(Client.GetInstance(), applicationId);
}
- public async static Task PartialUpdate(Client client, string applicationId, Application application )
+ public async static Task PartialUpdate(Client client, string applicationId, Application application)
{
//TODO need Patch
var item = await client.MakePatchRequest(client.ConcatAccountPath($"{applicatoinPath}/{applicationId}"), application);
@@ -88,7 +88,7 @@ public static Task Delete(string applicationId)
}
public async static Task ListAssociatedSippeers(Client client, string applicationId)
- {
+ {
var item = await client.MakeGetRequest(client.ConcatAccountPath($"{applicatoinPath}/{applicationId}/{associatedSipppeersPath}"));
item.Client = client;
return item;
diff --git a/Bandwidth.Iris/Model/AvailableNumbers.cs b/Bandwidth.Iris/Model/AvailableNumbers.cs
index 6c0d73f..8b67351 100644
--- a/Bandwidth.Iris/Model/AvailableNumbers.cs
+++ b/Bandwidth.Iris/Model/AvailableNumbers.cs
@@ -23,7 +23,7 @@ public static Task List(IDictionary quer
public class AvailableNumbersResult
{
public int ResultCount { get; set; }
-
+
[XmlArrayItem("TelephoneNumber")]
public string[] TelephoneNumberList { get; set; }
diff --git a/Bandwidth.Iris/Model/Csr.cs b/Bandwidth.Iris/Model/Csr.cs
index 1bdbe3d..f38d260 100644
--- a/Bandwidth.Iris/Model/Csr.cs
+++ b/Bandwidth.Iris/Model/Csr.cs
@@ -77,7 +77,7 @@ public static Task ListNotes(string orderId)
return ListNotes(Client.GetInstance(), orderId);
}
- public static Task UpdateNote(Client client, string orderId, string noteId, Note note)
+ public static Task UpdateNote(Client client, string orderId, string noteId, Note note)
{
var item = client.MakePutRequest(client.ConcatAccountPath($"{csrPath}/{orderId}/{notesPath}/{noteId}"), note);
return item;
@@ -140,10 +140,10 @@ public class CsrData
[XmlArray("WorkingTelephoneNumbersOnAccount")]
[XmlArrayItem("TelephoneNumber")]
public string[] WorkingTelephoneNumbersOnAccount { get; set; }
-
+
}
-
+
}
\ No newline at end of file
diff --git a/Bandwidth.Iris/Model/Disconnect.cs b/Bandwidth.Iris/Model/Disconnect.cs
index 49640c1..604b280 100644
--- a/Bandwidth.Iris/Model/Disconnect.cs
+++ b/Bandwidth.Iris/Model/Disconnect.cs
@@ -5,7 +5,7 @@
namespace Bandwidth.Iris.Model
{
- public class Disconnect: BaseModel
+ public class Disconnect : BaseModel
{
private const string DisconnectNumbersPath = "disconnects";
public static Task Create(Client client, string orderName, params string[] numbers)
@@ -15,9 +15,9 @@ public static Task Create(Client client, string orderName, params string[] numbe
Name = orderName,
DisconnectTelephoneNumberOrderType = new DisconnectTelephoneNumberOrderType
{
- TelephoneNumberList = new TelephoneNumberList
+ TelephoneNumberList = new TelephoneNumberList
{
- TelephoneNumbers = numbers
+ TelephoneNumbers = numbers
}
}
};
@@ -55,13 +55,13 @@ public class DisconnectTelephoneNumberOrder
[XmlElement("name")]
public string Name { get; set; }
[XmlElement("DisconnectTelephoneNumberOrderType")]
- public DisconnectTelephoneNumberOrderType DisconnectTelephoneNumberOrderType { get; set; }
+ public DisconnectTelephoneNumberOrderType DisconnectTelephoneNumberOrderType { get; set; }
}
public class DisconnectTelephoneNumberOrderType
{
[XmlElement("TelephoneNumberList")]
- public TelephoneNumberList TelephoneNumberList { get; set; }
+ public TelephoneNumberList TelephoneNumberList { get; set; }
}
public class TelephoneNumberList
diff --git a/Bandwidth.Iris/Model/Dlda.cs b/Bandwidth.Iris/Model/Dlda.cs
index df4a5c4..8cbcf89 100644
--- a/Bandwidth.Iris/Model/Dlda.cs
+++ b/Bandwidth.Iris/Model/Dlda.cs
@@ -8,14 +8,14 @@
namespace Bandwidth.Iris.Model
{
[XmlRoot("DldaOrder")]
- public class Dlda: BaseModel
+ public class Dlda : BaseModel
{
internal const string DldaPath = "dldas";
public static async Task Create(Client client, Dlda item)
{
- using (var response = await client.MakePostRequest(client.ConcatAccountPath(DldaPath), item, false))
+ using (var response = await client.MakePostRequest(client.ConcatAccountPath(DldaPath), item, false))
{
return await Get(client, client.GetIdFromLocationHeader(response.Headers.Location));
}
@@ -53,7 +53,7 @@ public Task Update(Dlda item)
return Client.MakePutRequest(Client.ConcatAccountPath(string.Format("{0}/{1}", DldaPath, Id)),
item, true);
}
-
+
public async Task GetHistory()
{
return
@@ -87,10 +87,10 @@ public override string Id
public class DldaOrderResponse
{
- public Dlda DldaOrder { get; set; }
+ public Dlda DldaOrder { get; set; }
}
-
+
public class DldaTnGroup
{
public TelephoneNumbers TelephoneNumbers { get; set; }
@@ -99,7 +99,7 @@ public class DldaTnGroup
public ListingName ListingName { get; set; }
public Address Address { get; set; }
public string SubscriberType { get; set; }
- public bool ListAddress { get; set;}
+ public bool ListAddress { get; set; }
}
public class ListingName
@@ -143,9 +143,9 @@ public class OrderHistoryWrapper
public class OrderHistoryItem
{
- public DateTime OrderDate {get; set;}
- public string Note{ get; set; }
- public string Author{ get; set; }
- public string Status{ get; set; }
+ public DateTime OrderDate { get; set; }
+ public string Note { get; set; }
+ public string Author { get; set; }
+ public string Status { get; set; }
}
}
diff --git a/Bandwidth.Iris/Model/Host.cs b/Bandwidth.Iris/Model/Host.cs
index c0c829e..b3939e6 100644
--- a/Bandwidth.Iris/Model/Host.cs
+++ b/Bandwidth.Iris/Model/Host.cs
@@ -37,7 +37,7 @@ public class SiteHost
public class SipPeerHost
{
public string SipPeerId { get; set; }
-
+
[XmlArrayItem("Host")]
public HostData[] VoiceHosts { get; set; }
diff --git a/Bandwidth.Iris/Model/InServiceNumber.cs b/Bandwidth.Iris/Model/InServiceNumber.cs
index 440680a..37223b2 100644
--- a/Bandwidth.Iris/Model/InServiceNumber.cs
+++ b/Bandwidth.Iris/Model/InServiceNumber.cs
@@ -4,7 +4,7 @@
namespace Bandwidth.Iris.Model
{
- public class InServiceNumber: BaseModel
+ public class InServiceNumber : BaseModel
{
internal const string InServiceNumberPath = "inserviceNumbers";
@@ -20,7 +20,7 @@ public static async Task GetTotals(Client client)
}
#if !PCL
-
+
public static Task List(IDictionary query = null)
{
return List(Client.GetInstance(), query);
diff --git a/Bandwidth.Iris/Model/Lidb.cs b/Bandwidth.Iris/Model/Lidb.cs
index 0c31fd7..9f98c2c 100644
--- a/Bandwidth.Iris/Model/Lidb.cs
+++ b/Bandwidth.Iris/Model/Lidb.cs
@@ -5,7 +5,7 @@
namespace Bandwidth.Iris.Model
{
[XmlRoot("LidbOrder")]
- public class Lidb: BaseModel
+ public class Lidb : BaseModel
{
internal const string LidbPath = "lidbs";
public static async Task Get(Client client, string id)
@@ -27,7 +27,7 @@ public static async Task List(Client client)
return (await client.MakeGetRequest(client.ConcatAccountPath(LidbPath))).ListOrderIdUserIdDate ?? new OrderIdUserIdDate[0];
}
-
+
#if !PCL
public static Task List()
@@ -63,9 +63,9 @@ public override string Id
OrderId = value;
}
}
-
+
public string CustomerOrderId { get; set; }
-
+
[XmlElement("OrderId")]
public string OrderId { get; set; }
@@ -74,26 +74,26 @@ public override string Id
public string ProcessingStatus { get; set; }
public string CreatedByUser { get; set; }
-
+
public DateTime LastModifiedDate { get; set; }
public DateTime OrderCompleteDate { get; set; }
- public LidbTnGroup[] LidbTnGroups{get; set;}
+ public LidbTnGroup[] LidbTnGroups { get; set; }
}
-
+
public class LidbTnGroup
{
[XmlArrayItem("TelephoneNumber")]
- public string[] TelephoneNumbers{get; set;}
-
- public string FullNumber {get; set;}
-
- public string SubscriberInformation {get; set;}
-
- public string UseType {get; set;}
-
- public string Visibility {get; set;}
+ public string[] TelephoneNumbers { get; set; }
+
+ public string FullNumber { get; set; }
+
+ public string SubscriberInformation { get; set; }
+
+ public string UseType { get; set; }
+
+ public string Visibility { get; set; }
}
}
diff --git a/Bandwidth.Iris/Model/LineOptionOrder.cs b/Bandwidth.Iris/Model/LineOptionOrder.cs
index 7dd411a..c151975 100644
--- a/Bandwidth.Iris/Model/LineOptionOrder.cs
+++ b/Bandwidth.Iris/Model/LineOptionOrder.cs
@@ -3,7 +3,7 @@
namespace Bandwidth.Iris.Model
{
- public class LineOptionOrder: BaseModel
+ public class LineOptionOrder : BaseModel
{
internal const string LineOptionOrderPath = "lineOptionOrders";
@@ -13,9 +13,9 @@ public static async Task Create(Client client, params TnLineOptions[]
return
(await
client.MakePostRequest(client.ConcatAccountPath(LineOptionOrderPath),
- new LineOptionOrderRequest {TnLineOptions = options})).LineOptions.CompletedNumbers;
+ new LineOptionOrderRequest { TnLineOptions = options })).LineOptions.CompletedNumbers;
}
-
+
#if !PCL
public static Task Create(params TnLineOptions[] options)
{
diff --git a/Bandwidth.Iris/Model/LnpChecker.cs b/Bandwidth.Iris/Model/LnpChecker.cs
index afee2cf..c7ca84a 100644
--- a/Bandwidth.Iris/Model/LnpChecker.cs
+++ b/Bandwidth.Iris/Model/LnpChecker.cs
@@ -69,7 +69,7 @@ public class RateCenterGroup
public string RateCenter { get; set; }
public string City { get; set; }
public string State { get; set; }
-
+
[XmlElement("LATA")]
public string Lata { get; set; }
diff --git a/Bandwidth.Iris/Model/LsrOrder.cs b/Bandwidth.Iris/Model/LsrOrder.cs
index 36c2dac..59add8e 100644
--- a/Bandwidth.Iris/Model/LsrOrder.cs
+++ b/Bandwidth.Iris/Model/LsrOrder.cs
@@ -7,7 +7,7 @@
namespace Bandwidth.Iris.Model
{
- public class LsrOrder: BaseModel
+ public class LsrOrder : BaseModel
{
internal const string LsrOrderPath = "lsrorders";
@@ -43,7 +43,7 @@ public static Task List(IDictionary query = n
public static async Task Create(Client client, LsrOrder item)
{
- using (var response = await client.MakePostRequest(client.ConcatAccountPath(LsrOrderPath), item, false))
+ using (var response = await client.MakePostRequest(client.ConcatAccountPath(LsrOrderPath), item, false))
{
return await Get(client, client.GetIdFromLocationHeader(response.Headers.Location));
}
@@ -89,30 +89,31 @@ public async Task GetHistory()
}
- public override string Id {
+ public override string Id
+ {
get { return OrderId; }
- set { OrderId = value; }
+ set { OrderId = value; }
}
-
+
public string OrderId { get; set; }
- public string CustomerOrderId {get; set;}
- public string LastModifiedBy {get; set;}
- public DateTime OrderCreateDate {get; set;}
- public DateTime LastModifiedDate {get; set;}
- public string AccountId {get; set;}
- public string OrderStatus {get; set;}
+ public string CustomerOrderId { get; set; }
+ public string LastModifiedBy { get; set; }
+ public DateTime OrderCreateDate { get; set; }
+ public DateTime LastModifiedDate { get; set; }
+ public string AccountId { get; set; }
+ public string OrderStatus { get; set; }
[XmlElement("SPID")]
- public string Spid {get; set;}
- public string BillingTelephoneNumber {get; set;}
- public string Pon {get; set;}
- public string PonVersion {get; set;}
- public DateTime RequestedFocDate {get; set;}
- public string AuthorizingPerson {get; set;}
- public Subscriber Subscriber {get; set;}
+ public string Spid { get; set; }
+ public string BillingTelephoneNumber { get; set; }
+ public string Pon { get; set; }
+ public string PonVersion { get; set; }
+ public DateTime RequestedFocDate { get; set; }
+ public string AuthorizingPerson { get; set; }
+ public Subscriber Subscriber { get; set; }
[XmlArrayItem("TelephoneNumber")]
- public string[] ListOfTelephoneNumbers {get;set;}
+ public string[] ListOfTelephoneNumbers { get; set; }
[XmlElement("CountOfTNs")]
- public int CountOfTns {get;set;}
+ public int CountOfTns { get; set; }
}
public class LsrOrders
diff --git a/Bandwidth.Iris/Model/Note.cs b/Bandwidth.Iris/Model/Note.cs
index bb9612c..a75a8b3 100644
--- a/Bandwidth.Iris/Model/Note.cs
+++ b/Bandwidth.Iris/Model/Note.cs
@@ -11,7 +11,7 @@ public class Note
public string UserId { get; set; }
public string Description { get; set; }
}
-
+
public class Notes
{
[XmlElementAttribute("Note")]
diff --git a/Bandwidth.Iris/Model/Order.cs b/Bandwidth.Iris/Model/Order.cs
index cc01520..08cae91 100644
--- a/Bandwidth.Iris/Model/Order.cs
+++ b/Bandwidth.Iris/Model/Order.cs
@@ -7,7 +7,7 @@
namespace Bandwidth.Iris.Model
{
- public class Order: BaseModel
+ public class Order : BaseModel
{
internal const string OrderPath = "orders";
@@ -109,11 +109,12 @@ public async Task GetHistory()
}
- public override string Id {
+ public override string Id
+ {
get { return OrderId; }
- set { OrderId = value; }
+ set { OrderId = value; }
}
-
+
[XmlElement("id")]
public string OrderId { get; set; }
public string Name { get; set; }
@@ -126,7 +127,7 @@ public override string Id {
public string CustomerOrderId { get; set; }
[DefaultValue(true)]
public bool PartialAllowed { get; set; }
- [DefaultValue(false)]
+ [DefaultValue(false)]
public bool CloseOrder { get; set; }
public ExistingTelephoneNumberOrderType ExistingTelephoneNumberOrderType { get; set; }
public AreaCodeSearchAndOrderType AreaCodeSearchAndOrderType { get; set; }
@@ -174,7 +175,7 @@ public class ZipSearchAndOrderType
public class CitySearchAndOrderType
{
- public string City{ get; set; }
+ public string City { get; set; }
public string State { get; set; }
public int Quantity { get; set; }
}
@@ -303,7 +304,7 @@ public class ListOrderIdUserIdDate
public int? TotalCount { get; set; }
public Links Links { get; set; }
[XmlElement("OrderIdUserIdDate")]
- public List OrderDetails {get; set;}
+ public List OrderDetails { get; set; }
}
[XmlType("OrderIdUserIdDate")]
@@ -330,7 +331,7 @@ public class OrderDetail
[XmlElement("TelephoneNumberDetails")]
public TelephoneNumberDetailsWithCount TelephoneNumberDetailsWithCount { get; set; }
-
+
}
[XmlType("TelephoneNumberDetails")]
diff --git a/Bandwidth.Iris/Model/PortIn.cs b/Bandwidth.Iris/Model/PortIn.cs
index beb58d2..c969c21 100644
--- a/Bandwidth.Iris/Model/PortIn.cs
+++ b/Bandwidth.Iris/Model/PortIn.cs
@@ -10,7 +10,7 @@
namespace Bandwidth.Iris.Model
{
[XmlType("LnpOrder")]
- public class PortIn: BaseModel
+ public class PortIn : BaseModel
{
private const string PortInPath = "portins";
private const string LoasPath = "loas";
@@ -87,8 +87,8 @@ public async Task GetFiles(bool metadata = false)
{
var r = (await Client.MakeGetRequest(
Client.ConcatAccountPath(string.Format("{0}/{1}/{2}", PortInPath, Id, LoasPath)),
- new Dictionary {{"metadata", metadata.ToString().ToLowerInvariant()}}));
- return (r == null)?new FileData[0]: r.FileData.ToArray();
+ new Dictionary { { "metadata", metadata.ToString().ToLowerInvariant() } }));
+ return (r == null) ? new FileData[0] : r.FileData.ToArray();
}
public async Task GetFile(string fileName, bool asStream = false)
@@ -123,7 +123,7 @@ public Task Delete()
public Task GetOrder()
{
- return Client.MakeGetRequest( Client.ConcatAccountPath(string.Format("{0}/{1}", PortInPath, Id)) );
+ return Client.MakeGetRequest(Client.ConcatAccountPath(string.Format("{0}/{1}", PortInPath, Id)));
}
public async Task AddNote(Note note)
{
@@ -157,13 +157,14 @@ public Task GetPortIns(string accountId, DateTime date, Date
if (pon != null) query.Add("pon", pon);
if (status != null) query.Add("status", status);
if (tn != null) query.Add("tn", tn);
-
- return Client.MakeGetRequest(Client.ConcatAccountPath( "/portins/"), query);
+
+ return Client.MakeGetRequest(Client.ConcatAccountPath("/portins/"), query);
}
- public override string Id {
+ public override string Id
+ {
get { return OrderId; }
- set { OrderId = value; }
+ set { OrderId = value; }
}
public string CustomerOrderId { get; set; }
@@ -185,7 +186,7 @@ public override string Id {
public string SiteId { get; set; }
public string PeerId { get; set; }
public bool Triggered { get; set; }
-
+
}
[XmlType("LNPResponseWrapper")]
@@ -212,7 +213,7 @@ public class LnpPortInfoForGivenStatus
[XmlElement("lastModifiedDate")]
public DateTime LastModifiedDate { get; set; }
- public DateTime OrderDate { get; set; }
+ public DateTime OrderDate { get; set; }
public string OrderId { get; set; }
@@ -232,7 +233,7 @@ public class LnpPortInfoForGivenStatus
}
-
+
public class LnpOrderResponse : PortIn
{
public string OrderId { get; set; }
@@ -252,7 +253,7 @@ public class LnpOrderResponse : PortIn
public string[] ListOfPhoneNumbers { get; set; }
public string AlternateSpid { get; set; }
public string AccountId { get; set; }
- public string SiteId { get; set;}
+ public string SiteId { get; set; }
public string PeerId { get; set; }
public string VendorName { get; set; }
public DateTime OrderCreateDate { get; set; }
@@ -269,7 +270,7 @@ public class LnpOrderResponse : PortIn
}
- public class LnpOrderSupp: PortIn
+ public class LnpOrderSupp : PortIn
{
public string CustomerOrderId { get; set; }
public string BillingTelephoneNumber { get; set; }
@@ -348,7 +349,7 @@ public class FileData
[XmlElement("FileMetaData")]
public FileMetadata FileMetadata { get; set; }
}
-
+
public class Errors
{
public string Code { get; set; }
diff --git a/Bandwidth.Iris/Model/PortOut.cs b/Bandwidth.Iris/Model/PortOut.cs
index 2d4db3f..1c10247 100644
--- a/Bandwidth.Iris/Model/PortOut.cs
+++ b/Bandwidth.Iris/Model/PortOut.cs
@@ -6,7 +6,7 @@ namespace Bandwidth.Iris.Model
public class PortOut
{
private const string PortOutPath = "portouts";
-
+
public static async Task AddNote(Client client, string orderId, Note note)
{
using (var response = await client.MakePostRequest(client.ConcatAccountPath(string.Format("{0}/{1}/notes", PortOutPath, orderId)), note))
diff --git a/Bandwidth.Iris/Model/SipPeer.cs b/Bandwidth.Iris/Model/SipPeer.cs
index 7129bbf..5e773ff 100644
--- a/Bandwidth.Iris/Model/SipPeer.cs
+++ b/Bandwidth.Iris/Model/SipPeer.cs
@@ -6,7 +6,7 @@
namespace Bandwidth.Iris.Model
{
- public class SipPeer: BaseModel
+ public class SipPeer : BaseModel
{
public string SiteId { get; set; }
@@ -44,7 +44,7 @@ public override string Id
public static Task Create(Client client, SipPeer item)
{
if (item.SiteId == null) throw new ArgumentException("SiteId is required");
- var site = new Site {Id = item.SiteId};
+ var site = new Site { Id = item.SiteId };
site.SetClient(client);
return site.CreateSipPeer(item);
}
@@ -98,7 +98,7 @@ public static Task List(string siteId)
#endif
public Task Delete()
{
- if(SiteId == null) throw new ArgumentNullException("SiteId");
+ if (SiteId == null) throw new ArgumentNullException("SiteId");
return Client.MakeDeleteRequest(Client.ConcatAccountPath(string.Format("{0}/{1}/{2}/{3}", Site.SitePath, SiteId, Site.SipPeerPath, Id)));
}
@@ -132,7 +132,7 @@ public Task UpdateTns(string number, SipPeerTelephoneNumber data)
if (SiteId == null) throw new ArgumentNullException("SiteId");
return Client.MakePutRequest(
Client.ConcatAccountPath(
- string.Format("{0}/{1}/{2}/{3}/{4}/{5}", Site.SitePath, SiteId,
+ string.Format("{0}/{1}/{2}/{3}/{4}/{5}", Site.SitePath, SiteId,
Site.SipPeerPath, Id, TnsPath, number)), data, true);
}
@@ -140,9 +140,9 @@ public Task MoveTns(params string[] numbers)
{
if (SiteId == null) throw new ArgumentNullException("SiteId");
return Client.MakePostRequest(
- Client.ConcatAccountPath(string.Format("{0}/{1}/{2}/{3}/{4}",
- Site.SitePath, SiteId, Site.SipPeerPath, Id, MoveTnsPath)),
- new SipPeerTelephoneNumbers{Numbers = numbers}, true);
+ Client.ConcatAccountPath(string.Format("{0}/{1}/{2}/{3}/{4}",
+ Site.SitePath, SiteId, Site.SipPeerPath, Id, MoveTnsPath)),
+ new SipPeerTelephoneNumbers { Numbers = numbers }, true);
}
#endregion
@@ -158,7 +158,7 @@ public static async Task GetOriginationSetti
client.ConcatAccountPath($"/sites/{siteId}/sippeers/{id}/{PRODUCTS}/{ORIGINATION}/{SETTINGS}")
);
}
- public static async Task GetOriginationSettings( string siteId, string id)
+ public static async Task GetOriginationSettings(string siteId, string id)
{
return await GetOriginationSettings(Client.GetInstance(), siteId, id);
}
@@ -193,7 +193,7 @@ public static Task UpdateOriginationSettings(string siteId, string id, SipPeerOr
#region .../product/termination/settings
public static readonly string TERMINATION = "termination";
-
+
public static async Task GetTerminationSetting(Client client, string siteId, string id)
{
return await client.MakeGetRequest(
@@ -206,7 +206,7 @@ public static async Task GetTerminationSetti
return await GetTerminationSetting(Client.GetInstance(), siteId, id);
}
- public static async Task SetTerminationSettings(Client client, string siteId, string id, SipPeerTerminationSettings settings )
+ public static async Task SetTerminationSettings(Client client, string siteId, string id, SipPeerTerminationSettings settings)
{
return await client.MakePostRequest(
client.ConcatAccountPath($"/sites/{siteId}/sippeers/{id}/{PRODUCTS}/{TERMINATION}/{SETTINGS}"),
@@ -287,7 +287,7 @@ public static Task DeleteSMSSettings(Client client, string siteId, string id)
);
}
- public static Task DeleteSMSSettings(string siteId, string id )
+ public static Task DeleteSMSSettings(string siteId, string id)
{
return DeleteSMSSettings(Client.GetInstance(), siteId, id);
}
@@ -347,7 +347,7 @@ public static async Task DeleteMMSSettings(string siteId, s
#region .../products/messaging/applicationSettings
- public static readonly string APPLICATION_SETTINGS = "applicationSettings";
+ public static readonly string APPLICATION_SETTINGS = "applicationSettings";
public static async Task GetApplicationSetting(Client client, string siteId, string id)
{
@@ -392,8 +392,8 @@ public static Task RemoveApplicationSettings(string siteId, string id)
- #endregion
- }
+ #endregion
+ }
public class CallingName
@@ -416,9 +416,9 @@ public class TerminationHost
public bool DataAllowed { get; set; }
}
- public class SipPeerTelephoneNumbers: IXmlSerializable
+ public class SipPeerTelephoneNumbers : IXmlSerializable
{
-
+
public string[] Numbers { get; set; }
public System.Xml.Schema.XmlSchema GetSchema()
@@ -485,7 +485,7 @@ public class HttpSettings
public class SipPeerTerminationSettingsResponse
{
- public SipPeerTerminationSettings SipPeerTerminationSettings { get; set;}
+ public SipPeerTerminationSettings SipPeerTerminationSettings { get; set; }
}
public class SipPeerTerminationSettings
diff --git a/Bandwidth.Iris/Model/Site.cs b/Bandwidth.Iris/Model/Site.cs
index f5ed2d7..9bb6ff9 100644
--- a/Bandwidth.Iris/Model/Site.cs
+++ b/Bandwidth.Iris/Model/Site.cs
@@ -4,7 +4,7 @@
namespace Bandwidth.Iris.Model
{
- public class Site: BaseModel
+ public class Site : BaseModel
{
internal const string SitePath = "sites";
public static async Task Get(Client client, string id)
@@ -31,7 +31,7 @@ public static async Task List(Client client)
return items;
}
-
+
#if !PCL
public static Task List()
@@ -75,7 +75,7 @@ public async Task CreateSipPeer(SipPeer item)
{
return await GetSipPeer(Client.GetIdFromLocationHeader(response.Headers.Location));
}
-
+
}
public async Task GetSipPeer(string id)
@@ -103,10 +103,10 @@ public async Task GetSipPeers()
var items =
(await Client.MakeGetRequest(
Client.ConcatAccountPath(string.Format("{0}/{1}/{2}", SitePath, Id, SipPeerPath)))).SipPeers;
- foreach(var item in items)
+ foreach (var item in items)
{
item.Client = Client;
- item.SiteId = Id;
+ item.SiteId = Id;
}
return items;
}
@@ -132,7 +132,7 @@ public class SipPeersResponse
public SipPeer[] SipPeers { get; set; }
}
-
+
public class Address
{
public string HouseNumber { get; set; }
diff --git a/Bandwidth.Iris/Model/Subscription.cs b/Bandwidth.Iris/Model/Subscription.cs
index cbc228d..70312b7 100644
--- a/Bandwidth.Iris/Model/Subscription.cs
+++ b/Bandwidth.Iris/Model/Subscription.cs
@@ -23,7 +23,7 @@ public static Task Get(string id)
}
#endif
- public static async Task List(Client client, IDictionary query = null )
+ public static async Task List(Client client, IDictionary query = null)
{
var items = (await client.MakeGetRequest(client.ConcatAccountPath(SubscriptionPath), query)).Subscriptions ?? new Subscription[0];
foreach (var item in items)
@@ -33,7 +33,7 @@ public static async Task List(Client client, IDictionary List(IDictionary query = null)
@@ -69,9 +69,10 @@ public Task Delete()
return Client.MakeDeleteRequest(Client.ConcatAccountPath(string.Format("{0}/{1}", SubscriptionPath, Id)));
}
- public override string Id {
+ public override string Id
+ {
get { return SubscriptionId; }
- set { SubscriptionId = value; }
+ set { SubscriptionId = value; }
}
public string SubscriptionId { get; set; }
public string OrderType { get; set; }
diff --git a/Bandwidth.Iris/Model/TnReservation.cs b/Bandwidth.Iris/Model/TnReservation.cs
index b1501ee..d1919d0 100644
--- a/Bandwidth.Iris/Model/TnReservation.cs
+++ b/Bandwidth.Iris/Model/TnReservation.cs
@@ -5,7 +5,7 @@
namespace Bandwidth.Iris.Model
{
[XmlType("Reservation")]
- public class TnReservation: BaseModel
+ public class TnReservation : BaseModel
{
internal const string TnReservationPath = "tnreservation";
public static async Task Get(Client client, string id)
@@ -39,7 +39,7 @@ public static Task Create(TnReservation item)
}
#endif
-
+
public Task Delete()
{
return Client.MakeDeleteRequest(Client.ConcatAccountPath(string.Format("{0}/{1}", TnReservationPath, Id)));
diff --git a/Bandwidth.Iris/Utf8StringWriter.cs b/Bandwidth.Iris/Utf8StringWriter.cs
index 1522df7..3a3fe6e 100644
--- a/Bandwidth.Iris/Utf8StringWriter.cs
+++ b/Bandwidth.Iris/Utf8StringWriter.cs
@@ -9,5 +9,5 @@ public override Encoding Encoding
{
get { return Encoding.UTF8; }
}
- }
+ }
}
From 3d0708f3e64325094476d5231aeb32ac1b92e5fc Mon Sep 17 00:00:00 2001
From: AJ Rice <53190766+ajrice6713@users.noreply.github.com>
Date: Wed, 13 Nov 2024 16:50:48 -0500
Subject: [PATCH 3/6] Fix Texts
---
.../Models/ApplicationTest.cs | 6 +-
.../Models/LnpCheckerTests.cs | 49 --------------
Bandwidth.Iris.Tests/Models/SiteTests.cs | 25 +------
Bandwidth.Iris.Tests/Models/TnOptionsTests.cs | 37 ----------
.../Models/TnReservationTests.cs | 3 +-
Bandwidth.Iris/Client.cs | 67 +++++++++----------
6 files changed, 41 insertions(+), 146 deletions(-)
diff --git a/Bandwidth.Iris.Tests/Models/ApplicationTest.cs b/Bandwidth.Iris.Tests/Models/ApplicationTest.cs
index ad7004c..95588f6 100644
--- a/Bandwidth.Iris.Tests/Models/ApplicationTest.cs
+++ b/Bandwidth.Iris.Tests/Models/ApplicationTest.cs
@@ -395,7 +395,8 @@ public void TestGetAssociatesSipPeers400()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = $"/v1.0/accounts/{Helper.AccountId}/applications/{applicationId}/associatedsippeers",
- ContentToSend = new StringContent(TestXmlStrings.associatedSipPeerResponse400, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.associatedSipPeerResponse400, Encoding.UTF8, "application/xml"),
+ StatusCodeToSend = 400
}))
{
@@ -432,7 +433,8 @@ public void TestGetAssociatesSipPeers404()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = $"/v1.0/accounts/{Helper.AccountId}/applications/{applicationId}/associatedsippeers",
- ContentToSend = new StringContent(TestXmlStrings.associatedSipPeerResponse404, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.associatedSipPeerResponse404, Encoding.UTF8, "application/xml"),
+ StatusCodeToSend = 404
}))
{
diff --git a/Bandwidth.Iris.Tests/Models/LnpCheckerTests.cs b/Bandwidth.Iris.Tests/Models/LnpCheckerTests.cs
index d7fedd3..7d3fa76 100644
--- a/Bandwidth.Iris.Tests/Models/LnpCheckerTests.cs
+++ b/Bandwidth.Iris.Tests/Models/LnpCheckerTests.cs
@@ -53,55 +53,6 @@ public void CheckTest()
}
}
- [Fact]
- public void CheckThrowsErrorTest()
- {
- var request = new NumberPortabilityRequest
- {
- TnList = new[] { "1111" }
- };
- var response = new BandwidthIrisException(
- "170",
- "error thrown",
- System.Net.HttpStatusCode.ExpectationFailed
- );
- using (var server = new HttpServer(new RequestHandler
- {
- EstimatedMethod = "POST",
- EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/lnpchecker?fullCheck=true", Helper.AccountId),
- EstimatedContent = Helper.ToXmlString(request),
- ContentToSend = new StringContent("919220216491978911467331
Rate Center Not Present in Bandwidth Dashboard5555555555DURHAMDURHAMNC42609192202164RALEIGHRALEIGHNC42609197891146", Encoding.UTF8, "application/xml")
-
- }))
- {
- var client = Helper.CreateClient();
- try
- {
- var result = LnpChecker.Check(client, new[] { "1111" }, true).Result;
- }
- catch (BandwidthIrisException e)
- {
- return;
- }
- catch (AggregateException e)
- {
- Exception innerEx = e;
- while (innerEx != null)
- {
- string mesg = innerEx.Message;
- innerEx = innerEx.InnerException;
- Console.WriteLine(mesg);
- }
- return;
- }
- catch (Exception e)
- {
- return;
- }
- Assert.True(false, "The exception was not thrown");
- }
- }
-
[Fact]
public void CheckWithXmlTest()
{
diff --git a/Bandwidth.Iris.Tests/Models/SiteTests.cs b/Bandwidth.Iris.Tests/Models/SiteTests.cs
index 1bc4c91..f344f21 100644
--- a/Bandwidth.Iris.Tests/Models/SiteTests.cs
+++ b/Bandwidth.Iris.Tests/Models/SiteTests.cs
@@ -553,29 +553,8 @@ public void BandwidthIrisExcpetionTest()
}))
{
var client = Helper.CreateClient();
-
- bool error = false;
- try
- {
- var i = Site.Get("1").Result;
- }
- catch (AggregateException e)
- {
- e.Handle((x) =>
- {
- if (x is BandwidthIrisException)
- {
- error = true;
- return true;
- }
-
- return false;
- });
-
- }
- Assert.True(error);
-
-
+ var i = Site.Get("1").Result;
+ Assert.Equal("Csharp Test Site", i.Name);
}
}
}
diff --git a/Bandwidth.Iris.Tests/Models/TnOptionsTests.cs b/Bandwidth.Iris.Tests/Models/TnOptionsTests.cs
index a727585..aaa11c4 100644
--- a/Bandwidth.Iris.Tests/Models/TnOptionsTests.cs
+++ b/Bandwidth.Iris.Tests/Models/TnOptionsTests.cs
@@ -54,43 +54,6 @@ public void TestGet()
[Fact]
public void TestList()
- {
- using (var server = new HttpServer(new RequestHandler
- {
- EstimatedMethod = "GET",
- EstimatedPathAndQuery = $"/v1.0/accounts/{Helper.AccountId}/tnoptions?status=9199918388",
- ContentToSend = new StringContent(TestXmlStrings.listTnOptions, Encoding.UTF8, "application/xml")
- }))
- {
- var client = Helper.CreateClient();
- TnOptionOrders result = null;
- try
- {
- result = TnOptions.List(client, new Dictionary
- {
- {"status", "9199918388" }
- }).Result;
- throw new Exception("Should have found error");
- }
- catch (Exception ex)
- {
- Assert.NotNull(ex);
- if (ex.InnerException is BandwidthIrisException)
- {
- var exInner = (BandwidthIrisException)ex.InnerException;
- Console.WriteLine(exInner.Message); //"Telephone number is not available"
- Console.WriteLine(exInner.Body);
- }
- }
- if (server.Error != null) throw server.Error;
-
- Assert.Null(result);
-
- }
- }
-
- [Fact]
- public void TestListNoError()
{
using (var server = new HttpServer(new RequestHandler
{
diff --git a/Bandwidth.Iris.Tests/Models/TnReservationTests.cs b/Bandwidth.Iris.Tests/Models/TnReservationTests.cs
index 78752eb..b88343d 100644
--- a/Bandwidth.Iris.Tests/Models/TnReservationTests.cs
+++ b/Bandwidth.Iris.Tests/Models/TnReservationTests.cs
@@ -67,7 +67,8 @@ public void GetWithErrorXmlTest()
{
EstimatedMethod = "GET",
EstimatedPathAndQuery = string.Format("/v1.0/accounts/{0}/tnreservation/1", Helper.AccountId),
- ContentToSend = new StringContent(TestXmlStrings.InvalidReservationResponseXml, Encoding.UTF8, "application/xml")
+ ContentToSend = new StringContent(TestXmlStrings.InvalidReservationResponseXml, Encoding.UTF8, "application/xml"),
+ StatusCodeToSend = 400
}))
{
var client = Helper.CreateClient();
diff --git a/Bandwidth.Iris/Client.cs b/Bandwidth.Iris/Client.cs
index e9f90fa..6f4306f 100644
--- a/Bandwidth.Iris/Client.cs
+++ b/Bandwidth.Iris/Client.cs
@@ -397,51 +397,50 @@ private static string FixPath(string path)
private async Task CheckResponse(HttpResponseMessage response)
{
- try
+ if (!response.IsSuccessStatusCode)
{
- var xml = await response.Content.ReadAsStringAsync();
- if (xml.Length > 0)
+ try
{
- var doc = XDocument.Parse(xml);
- var code = doc.Descendants("ErrorCode").FirstOrDefault();
- var description = doc.Descendants("Description").FirstOrDefault();
- if (code == null)
+ var xml = await response.Content.ReadAsStringAsync();
+ if (xml.Length > 0)
{
- var error = doc.Descendants("Error").FirstOrDefault();
- if (error == null)
+ var doc = XDocument.Parse(xml);
+ var code = doc.Descendants("ErrorCode").FirstOrDefault();
+ var description = doc.Descendants("Description").FirstOrDefault();
+ if (code == null)
{
- var exceptions =
- (from item in doc.Descendants("Errors")
- select
- (Exception)new BandwidthIrisException(item.Element("Code").Value,
- item.Element("Description").Value, response.StatusCode)).ToArray();
- if (exceptions.Length > 0)
+ var error = doc.Descendants("Error").FirstOrDefault();
+ if (error == null)
+ {
+ var exceptions =
+ (from item in doc.Descendants("Errors")
+ select
+ (Exception)new BandwidthIrisException(item.Element("Code").Value,
+ item.Element("Description").Value, response.StatusCode)).ToArray();
+ if (exceptions.Length > 0)
+ {
+ throw new AggregateException(exceptions);
+ }
+ code = doc.Descendants("resultCode").FirstOrDefault();
+ description = doc.Descendants("resultMessage").FirstOrDefault();
+ }
+ else
{
- throw new AggregateException(exceptions);
+ code = error.Element("Code");
+ description = error.Element("Description");
}
- code = doc.Descendants("resultCode").FirstOrDefault();
- description = doc.Descendants("resultMessage").FirstOrDefault();
}
- else
+ if (code != null && description != null && !string.IsNullOrEmpty(code.Value) && code.Value != "0")
{
- code = error.Element("Code");
- description = error.Element("Description");
+ throw new BandwidthIrisException(code.Value, description.Value, response.StatusCode, doc);
}
}
- if (code != null && description != null && !string.IsNullOrEmpty(code.Value) && code.Value != "0")
- {
- throw new BandwidthIrisException(code.Value, description.Value, response.StatusCode, doc);
- }
}
- }
- catch (Exception ex)
- {
- if (ex is BandwidthIrisException || ex is AggregateException) throw;
- Debug.WriteLine(ex.Message);
- }
- if (!response.IsSuccessStatusCode)
- {
- throw new BandwidthIrisException("", string.Format("Http code {0}", response.StatusCode), response.StatusCode);
+ catch (Exception ex) when (!(ex is BandwidthIrisException) && !(ex is AggregateException))
+ {
+
+ throw new BandwidthIrisException("", string.Format("Http code {0}", response.StatusCode), response.StatusCode);
+ }
}
}
From b895d04e5493136753ae244ce194b0c46172f600 Mon Sep 17 00:00:00 2001
From: AJ Rice <53190766+ajrice6713@users.noreply.github.com>
Date: Thu, 14 Nov 2024 11:42:13 -0500
Subject: [PATCH 4/6] Unnecessary null check
---
Bandwidth.Iris/Client.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Bandwidth.Iris/Client.cs b/Bandwidth.Iris/Client.cs
index 6f4306f..828158d 100644
--- a/Bandwidth.Iris/Client.cs
+++ b/Bandwidth.Iris/Client.cs
@@ -430,7 +430,7 @@ private async Task CheckResponse(HttpResponseMessage response)
description = error.Element("Description");
}
}
- if (code != null && description != null && !string.IsNullOrEmpty(code.Value) && code.Value != "0")
+ if (description != null && !string.IsNullOrEmpty(code.Value) && code.Value != "0")
{
throw new BandwidthIrisException(code.Value, description.Value, response.StatusCode, doc);
}
From 615558a3667d6005c65b9b84046954058f52c5d0 Mon Sep 17 00:00:00 2001
From: AJ Rice <53190766+ajrice6713@users.noreply.github.com>
Date: Thu, 14 Nov 2024 12:57:58 -0500
Subject: [PATCH 5/6] Code can still be null at this point
---
Bandwidth.Iris/Client.cs | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Bandwidth.Iris/Client.cs b/Bandwidth.Iris/Client.cs
index 828158d..6f4306f 100644
--- a/Bandwidth.Iris/Client.cs
+++ b/Bandwidth.Iris/Client.cs
@@ -430,7 +430,7 @@ private async Task CheckResponse(HttpResponseMessage response)
description = error.Element("Description");
}
}
- if (description != null && !string.IsNullOrEmpty(code.Value) && code.Value != "0")
+ if (code != null && description != null && !string.IsNullOrEmpty(code.Value) && code.Value != "0")
{
throw new BandwidthIrisException(code.Value, description.Value, response.StatusCode, doc);
}
From 70829c60dfd28058f83a41cd1b8aeef6c316ad2d Mon Sep 17 00:00:00 2001
From: AJ Rice <53190766+ajrice6713@users.noreply.github.com>
Date: Thu, 14 Nov 2024 13:08:02 -0500
Subject: [PATCH 6/6] Less Nesting
---
Bandwidth.Iris/Client.cs | 63 +++++++++++++++++++---------------------
1 file changed, 30 insertions(+), 33 deletions(-)
diff --git a/Bandwidth.Iris/Client.cs b/Bandwidth.Iris/Client.cs
index 6f4306f..76cffc2 100644
--- a/Bandwidth.Iris/Client.cs
+++ b/Bandwidth.Iris/Client.cs
@@ -397,50 +397,47 @@ private static string FixPath(string path)
private async Task CheckResponse(HttpResponseMessage response)
{
- if (!response.IsSuccessStatusCode)
+ if (response.IsSuccessStatusCode) return;
+ try
{
- try
+ var xml = await response.Content.ReadAsStringAsync();
+ if (xml.Length > 0)
{
- var xml = await response.Content.ReadAsStringAsync();
- if (xml.Length > 0)
+ var doc = XDocument.Parse(xml);
+ var code = doc.Descendants("ErrorCode").FirstOrDefault();
+ var description = doc.Descendants("Description").FirstOrDefault();
+ if (code == null)
{
- var doc = XDocument.Parse(xml);
- var code = doc.Descendants("ErrorCode").FirstOrDefault();
- var description = doc.Descendants("Description").FirstOrDefault();
- if (code == null)
+ var error = doc.Descendants("Error").FirstOrDefault();
+ if (error == null)
{
- var error = doc.Descendants("Error").FirstOrDefault();
- if (error == null)
- {
- var exceptions =
- (from item in doc.Descendants("Errors")
- select
- (Exception)new BandwidthIrisException(item.Element("Code").Value,
- item.Element("Description").Value, response.StatusCode)).ToArray();
- if (exceptions.Length > 0)
- {
- throw new AggregateException(exceptions);
- }
- code = doc.Descendants("resultCode").FirstOrDefault();
- description = doc.Descendants("resultMessage").FirstOrDefault();
- }
- else
+ var exceptions =
+ (from item in doc.Descendants("Errors")
+ select
+ (Exception)new BandwidthIrisException(item.Element("Code").Value,
+ item.Element("Description").Value, response.StatusCode)).ToArray();
+ if (exceptions.Length > 0)
{
- code = error.Element("Code");
- description = error.Element("Description");
+ throw new AggregateException(exceptions);
}
+ code = doc.Descendants("resultCode").FirstOrDefault();
+ description = doc.Descendants("resultMessage").FirstOrDefault();
}
- if (code != null && description != null && !string.IsNullOrEmpty(code.Value) && code.Value != "0")
+ else
{
- throw new BandwidthIrisException(code.Value, description.Value, response.StatusCode, doc);
+ code = error.Element("Code");
+ description = error.Element("Description");
}
}
+ if (code != null && description != null && !string.IsNullOrEmpty(code.Value) && code.Value != "0")
+ {
+ throw new BandwidthIrisException(code.Value, description.Value, response.StatusCode, doc);
+ }
}
- catch (Exception ex) when (!(ex is BandwidthIrisException) && !(ex is AggregateException))
- {
-
- throw new BandwidthIrisException("", string.Format("Http code {0}", response.StatusCode), response.StatusCode);
- }
+ }
+ catch (Exception ex) when (!(ex is BandwidthIrisException) && !(ex is AggregateException))
+ {
+ throw new BandwidthIrisException("", string.Format("Http code {0}", response.StatusCode), response.StatusCode);
}
}