Skip to content

Commit

Permalink
Adding verify test
Browse files Browse the repository at this point in the history
  • Loading branch information
slorello89 committed Feb 5, 2020
1 parent 0ffe46d commit 7b6e013
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Nexmo.Api.Test.Unit/AccountTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public void Get#()
{
//ARRANGE
var expectedUri = $"{RestUrl}/account/get-#/outbound/?country=US&api_key={ApiKey}&api_secret={ApiSecret}&";
var expectedResponseContent = @"{""country"":""US"",""name"":""United States"",""prefix"":""1"",""mt"":""0.00480000"",""networks"":[{""code"":""US-FIXED"",""network"":""United States of America Landline"",""mtPrice"":""0.00480000""},{""code"":""311340"",""network"":""Illinois Valley Cellular RSA 2-I Partnership"",""mtPrice"":""0.00480000""},{""code"":""311740"",""network"":""TelAlaska Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""311910"",""network"":""SI WIRELESS, LLC"",""mtPrice"":""0.00480000""},{""code"":""310860"",""network"":""Five Star Wireless"",""mtPrice"":""0.00480000""},{""code"":""310760"",""network"":""Panhandle Telecommunications Systems, Inc."",""mtPrice"":""0.00480000""},{""code"":""310011"",""network"":""Northstar Technology, LLC"",""mtPrice"":""0.00480000""},{""code"":""311887"",""network"":""XO California, Inc."",""mtPrice"":""0.00480000""},{""code"":""311380"",""network"":""NEW DIMENSION WIRELESS LTD."",""mtPrice"":""0.00480000""},{""code"":""310300"",""network"":""Smart Call, LLC"",""mtPrice"":""0.00480000""},{""code"":""310004"",""network"":""Verizon Wireless"",""mtPrice"":""0.00480000""},{""code"":""US-VOIP"",""network"":""United States of America VoIP"",""mtPrice"":""0.00480000""},{""code"":""311580"",""network"":""United States Cellular Corp. - Maine"",""mtPrice"":""0.00480000""},{""code"":""311230"",""network"":""Cellular South, Inc."",""mtPrice"":""0.00480000""},{""code"":""310610"",""network"":""Epic Touch Co."",""mtPrice"":""0.00480000""},{""code"":""310060"",""network"":""New Cell, Inc. dba CeLLCom"",""mtPrice"":""0.00480000""},{""code"":""310870"",""network"":""Kaplan Telephone Company"",""mtPrice"":""0.00480000""},{""code"":""310750"",""network"":""East Kentucky Netwrk, LLC dba Appalachian Wireless"",""mtPrice"":""0.00480000""},{""code"":""311290"",""network"":""Pinpoint Wireless, Inc."",""mtPrice"":""0.00480000""},{""code"":""311330"",""network"":""Michigan Wireless, LLC dba Bug Tussel Wireless"",""mtPrice"":""0.00480000""},{""code"":""310710"",""network"":""ASTAC Wireless LLC"",""mtPrice"":""0.00480000""},{""code"":""311050"",""network"":""Wilkes Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""310770"",""network"":""Iowa Wireless Services, Lp"",""mtPrice"":""0.00480000""},{""code"":""310100"",""network"":""Plateau Telecommunications, Inc."",""mtPrice"":""0.00480000""},{""code"":""311090"",""network"":""Flat Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""311190"",""network"":""Cellular Properties, Inc."",""mtPrice"":""0.00480000""},{""code"":""311710"",""network"":""NORTHEAST WIRELESS NETWORKS, LLC"",""mtPrice"":""0.00480000""},{""code"":""311370"",""network"":""NACS Wireless, Inc."",""mtPrice"":""0.00480000""},{""code"":""311430"",""network"":""RSA 1 Limited Partnership dba Chat Mobility"",""mtPrice"":""0.00480000""},{""code"":""311100"",""network"":""Nex-Tech Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""311240"",""network"":""Cordova Wireless Communications, Inc."",""mtPrice"":""0.00480000""},{""code"":""316011"",""network"":""Southern Communications Services"",""mtPrice"":""0.00480000""},{""code"":""310340"",""network"":""Westlink Communications, LLC"",""mtPrice"":""0.00480000""},{""code"":""311860"",""network"":""Uintah Basin Electronic Telecommunications"",""mtPrice"":""0.00480000""},{""code"":""311670"",""network"":""Pine Belt Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""US-PREMIUM"",""network"":""United States Premium"",""mtPrice"":""0.00480000""},{""code"":""310570"",""network"":""MTPCS, LLC"",""mtPrice"":""0.00480000""},{""code"":""310180"",""network"":""CT Cube, L.P. dba West Central Cellular"",""mtPrice"":""0.00480000""},{""code"":""311080"",""network"":""Pine Telephone Co."",""mtPrice"":""0.00480000""},{""code"":""310130"",""network"":""Carolina West"",""mtPrice"":""0.00480000""},{""code"":""310580"",""network"":""Inland Cellular"",""mtPrice"":""0.00480000""},{""code"":""311040"",""network"":""Commnet Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""316993"",""network"":""Cablevision Lightpath, Inc. - NY"",""mtPrice"":""0.00480000""},{""code"":""316995"",""network"":""Coral Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""311410"",""network"":""Iowa RSA 2 Limited Partnership dba Chat Mobility"",""mtPrice"":""0.00480000""},{""code"":""310630"",""network"":""Choice Wireless LC"",""mtPrice"":""0.00480000""},{""code"":""311420"",""network"":""Northwest Missouri Cellular Limited Partnership"",""mtPrice"":""0.00480000""},{""code"":""310270"",""network"":""POWERTEL MEMPHIS LICENSES, INC."",""mtPrice"":""0.00480000""},{""code"":""31100"",""network"":""Mid-Tex Cellular Ltd."",""mtPrice"":""0.00480000""},{""code"":""311610"",""network"":""North Dakota Network Co dba SRT Wireless"",""mtPrice"":""0.00480000""},{""code"":""316884"",""network"":""Kentucky RSA 4 Cellular General Partnership"",""mtPrice"":""0.00480000""},{""code"":""310540"",""network"":""Oklahoma Western Telephone Company"",""mtPrice"":""0.00480000""},{""code"":""316885"",""network"":""Sagebrush Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""316883"",""network"":""Virginia PCS Alliance, L.c."",""mtPrice"":""0.00480000""},{""code"":""312040"",""network"":""Custer Telephone Cooperative, Inc."",""mtPrice"":""0.00480000""},{""code"":""311650"",""network"":""United Wireless Communications, Inc."",""mtPrice"":""0.00480000""},{""code"":""310690"",""network"":""Keystone Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""310120"",""network"":""SPRINT Spectrum L.P."",""mtPrice"":""0.00480000""},{""code"":""310020"",""network"":""Union Telephone Company"",""mtPrice"":""0.00480000""},{""code"":""311020"",""network"":""Chariton Valley Cellular"",""mtPrice"":""0.00480000""},{""code"":""311030"",""network"":""Indigo Wireless, Inc."",""mtPrice"":""0.00480000""},{""code"":""311310"",""network"":""New Mexico RSA 6-III Partnership dba Leaco Rural"",""mtPrice"":""0.00480000""},{""code"":""310023"",""network"":""Voicestream GSM I, LLC"",""mtPrice"":""0.00480000""},{""code"":""310320"",""network"":""Smith Bagley Inc. dba Cellular One of Ne Arizona"",""mtPrice"":""0.00480000""},{""code"":""311730"",""network"":""Proximity Mobility, LLC"",""mtPrice"":""0.00480000""},{""code"":""310260"",""network"":""T-mobile USA, Inc."",""mtPrice"":""0.00480000""},{""code"":""310450"",""network"":""N.E. Colorado Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""310090"",""network"":""AT&T Mobility"",""mtPrice"":""0.00480000""},{""code"":""310740"",""network"":""Tracy Corporation Ii"",""mtPrice"":""0.00480000""},{""code"":""311690"",""network"":""Telebeeper of New Mexico"",""mtPrice"":""0.00480000""},{""code"":""310840"",""network"":""Telecom North America Mobile Inc"",""mtPrice"":""0.00480000""},{""code"":""310880"",""network"":""Advantage Cellular Systems, Inc."",""mtPrice"":""0.00480000""}]}";
var expectedResponseContent = @"{""country"":""US"",""name"":""United States"",""countryDisplayName"":""United States"",""prefix"":""1"",""mt"":""0.00480000"",""networks"":[{""code"":""US-FIXED"",""network"":""United States of America Landline"",""mtPrice"":""0.00480000"",""ranges"":""""},{""code"":""311340"",""network"":""Illinois Valley Cellular RSA 2-I Partnership"",""mtPrice"":""0.00480000""},{""code"":""311740"",""network"":""TelAlaska Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""311910"",""network"":""SI WIRELESS, LLC"",""mtPrice"":""0.00480000""},{""code"":""310860"",""network"":""Five Star Wireless"",""mtPrice"":""0.00480000""},{""code"":""310760"",""network"":""Panhandle Telecommunications Systems, Inc."",""mtPrice"":""0.00480000""},{""code"":""310011"",""network"":""Northstar Technology, LLC"",""mtPrice"":""0.00480000""},{""code"":""311887"",""network"":""XO California, Inc."",""mtPrice"":""0.00480000""},{""code"":""311380"",""network"":""NEW DIMENSION WIRELESS LTD."",""mtPrice"":""0.00480000""},{""code"":""310300"",""network"":""Smart Call, LLC"",""mtPrice"":""0.00480000""},{""code"":""310004"",""network"":""Verizon Wireless"",""mtPrice"":""0.00480000""},{""code"":""US-VOIP"",""network"":""United States of America VoIP"",""mtPrice"":""0.00480000""},{""code"":""311580"",""network"":""United States Cellular Corp. - Maine"",""mtPrice"":""0.00480000""},{""code"":""311230"",""network"":""Cellular South, Inc."",""mtPrice"":""0.00480000""},{""code"":""310610"",""network"":""Epic Touch Co."",""mtPrice"":""0.00480000""},{""code"":""310060"",""network"":""New Cell, Inc. dba CeLLCom"",""mtPrice"":""0.00480000""},{""code"":""310870"",""network"":""Kaplan Telephone Company"",""mtPrice"":""0.00480000""},{""code"":""310750"",""network"":""East Kentucky Netwrk, LLC dba Appalachian Wireless"",""mtPrice"":""0.00480000""},{""code"":""311290"",""network"":""Pinpoint Wireless, Inc."",""mtPrice"":""0.00480000""},{""code"":""311330"",""network"":""Michigan Wireless, LLC dba Bug Tussel Wireless"",""mtPrice"":""0.00480000""},{""code"":""310710"",""network"":""ASTAC Wireless LLC"",""mtPrice"":""0.00480000""},{""code"":""311050"",""network"":""Wilkes Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""310770"",""network"":""Iowa Wireless Services, Lp"",""mtPrice"":""0.00480000""},{""code"":""310100"",""network"":""Plateau Telecommunications, Inc."",""mtPrice"":""0.00480000""},{""code"":""311090"",""network"":""Flat Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""311190"",""network"":""Cellular Properties, Inc."",""mtPrice"":""0.00480000""},{""code"":""311710"",""network"":""NORTHEAST WIRELESS NETWORKS, LLC"",""mtPrice"":""0.00480000""},{""code"":""311370"",""network"":""NACS Wireless, Inc."",""mtPrice"":""0.00480000""},{""code"":""311430"",""network"":""RSA 1 Limited Partnership dba Chat Mobility"",""mtPrice"":""0.00480000""},{""code"":""311100"",""network"":""Nex-Tech Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""311240"",""network"":""Cordova Wireless Communications, Inc."",""mtPrice"":""0.00480000""},{""code"":""316011"",""network"":""Southern Communications Services"",""mtPrice"":""0.00480000""},{""code"":""310340"",""network"":""Westlink Communications, LLC"",""mtPrice"":""0.00480000""},{""code"":""311860"",""network"":""Uintah Basin Electronic Telecommunications"",""mtPrice"":""0.00480000""},{""code"":""311670"",""network"":""Pine Belt Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""US-PREMIUM"",""network"":""United States Premium"",""mtPrice"":""0.00480000""},{""code"":""310570"",""network"":""MTPCS, LLC"",""mtPrice"":""0.00480000""},{""code"":""310180"",""network"":""CT Cube, L.P. dba West Central Cellular"",""mtPrice"":""0.00480000""},{""code"":""311080"",""network"":""Pine Telephone Co."",""mtPrice"":""0.00480000""},{""code"":""310130"",""network"":""Carolina West"",""mtPrice"":""0.00480000""},{""code"":""310580"",""network"":""Inland Cellular"",""mtPrice"":""0.00480000""},{""code"":""311040"",""network"":""Commnet Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""316993"",""network"":""Cablevision Lightpath, Inc. - NY"",""mtPrice"":""0.00480000""},{""code"":""316995"",""network"":""Coral Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""311410"",""network"":""Iowa RSA 2 Limited Partnership dba Chat Mobility"",""mtPrice"":""0.00480000""},{""code"":""310630"",""network"":""Choice Wireless LC"",""mtPrice"":""0.00480000""},{""code"":""311420"",""network"":""Northwest Missouri Cellular Limited Partnership"",""mtPrice"":""0.00480000""},{""code"":""310270"",""network"":""POWERTEL MEMPHIS LICENSES, INC."",""mtPrice"":""0.00480000""},{""code"":""31100"",""network"":""Mid-Tex Cellular Ltd."",""mtPrice"":""0.00480000""},{""code"":""311610"",""network"":""North Dakota Network Co dba SRT Wireless"",""mtPrice"":""0.00480000""},{""code"":""316884"",""network"":""Kentucky RSA 4 Cellular General Partnership"",""mtPrice"":""0.00480000""},{""code"":""310540"",""network"":""Oklahoma Western Telephone Company"",""mtPrice"":""0.00480000""},{""code"":""316885"",""network"":""Sagebrush Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""316883"",""network"":""Virginia PCS Alliance, L.c."",""mtPrice"":""0.00480000""},{""code"":""312040"",""network"":""Custer Telephone Cooperative, Inc."",""mtPrice"":""0.00480000""},{""code"":""311650"",""network"":""United Wireless Communications, Inc."",""mtPrice"":""0.00480000""},{""code"":""310690"",""network"":""Keystone Wireless, LLC"",""mtPrice"":""0.00480000""},{""code"":""310120"",""network"":""SPRINT Spectrum L.P."",""mtPrice"":""0.00480000""},{""code"":""310020"",""network"":""Union Telephone Company"",""mtPrice"":""0.00480000""},{""code"":""311020"",""network"":""Chariton Valley Cellular"",""mtPrice"":""0.00480000""},{""code"":""311030"",""network"":""Indigo Wireless, Inc."",""mtPrice"":""0.00480000""},{""code"":""311310"",""network"":""New Mexico RSA 6-III Partnership dba Leaco Rural"",""mtPrice"":""0.00480000""},{""code"":""310023"",""network"":""Voicestream GSM I, LLC"",""mtPrice"":""0.00480000""},{""code"":""310320"",""network"":""Smith Bagley Inc. dba Cellular One of Ne Arizona"",""mtPrice"":""0.00480000""},{""code"":""311730"",""network"":""Proximity Mobility, LLC"",""mtPrice"":""0.00480000""},{""code"":""310260"",""network"":""T-mobile USA, Inc."",""mtPrice"":""0.00480000""},{""code"":""310450"",""network"":""N.E. Colorado Cellular, Inc."",""mtPrice"":""0.00480000""},{""code"":""310090"",""network"":""AT&T Mobility"",""mtPrice"":""0.00480000""},{""code"":""310740"",""network"":""Tracy Corporation Ii"",""mtPrice"":""0.00480000""},{""code"":""311690"",""network"":""Telebeeper of New Mexico"",""mtPrice"":""0.00480000""},{""code"":""310840"",""network"":""Telecom North America Mobile Inc"",""mtPrice"":""0.00480000""},{""code"":""310880"",""network"":""Advantage Cellular Systems, Inc."",""mtPrice"":""0.00480000""}]}";
Setup(uri: expectedUri, responseContent: expectedResponseContent);

//ACT
Expand Down
32 changes: 32 additions & 0 deletions Nexmo.Api.Test.Unit/NumberVerifyTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,37 @@ public void SendControl()
Assert.Equal("0", results.status);
Assert.Equal("cancel", results.command);
}

[Fact]
public void SendVerifyRequest()
{
//ARRANGE
var expectedUri = $"{ApiUrl}/verify/json?number=12018675309&country=US&brand=AcmeInc&sender_id=ACME&code_length=6&lg=en-US&pin_expiry=240&next_event_wait=120&workflow_id=4&api_key={ApiKey}&api_secret={ApiSecret}&";

var expectedResult = @"{
""request_id"": ""abcdef012345..."",
""status"": ""0""
}";

Setup(uri: expectedUri, responseContent: expectedResult);

//ACT
var request = new NumberVerify.VerifyRequest()
{
number = "12018675309",
brand = "AcmeInc",
country = "US",
sender_id = "ACME",
code_length = "6",
lg = "en-US",
pin_expiry = "240",
next_event_wait = "120",
workflow_id = "4"
};
var client = new Client(new Request.Credentials() { ApiKey = ApiKey, ApiSecret = ApiSecret });
client.NumberVerify.Verify(request);


}
}
}
16 changes: 8 additions & 8 deletions Nexmo.Api.Test.Unit/SmsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,14 @@ public void TestDLRStruct()
""message-timestamp"": ""2020-01-01T12:00:00.000+00:00""
}";
var castObject = JsonConvert.DeserializeObject<SMS.SMSDeliveryReceipt>(dlrRct);
Assert.Equal(castObject.msisdn, "447700900000");
Assert.Equal(castObject.to, "AcmeInc");
Assert.Equal(castObject.network_code, "12345");
Assert.Equal(castObject.messageId, "0A0000001234567B");
Assert.Equal(castObject.price, "0.03330000");
Assert.Equal(castObject.status, "delivered");
Assert.Equal(castObject.scts, "2001011400");
Assert.Equal(castObject.err_code, "0");
Assert.Equal("447700900000", castObject.msisdn);
Assert.Equal("AcmeInc", castObject.to);
Assert.Equal("12345", castObject.network_code);
Assert.Equal("0A0000001234567B", castObject.messageId);
Assert.Equal("0.03330000", castObject.price);
Assert.Equal("delivered", castObject.status);
Assert.Equal("2001011400", castObject.scts);
Assert.Equal("0", castObject.err_code);
var ci = System.Globalization.CultureInfo.GetCultureInfo("en-us");
Assert.Equal(castObject.message_timestamp, System.DateTime.Parse("2020-01-01T12:00:00.000+00:00",ci));

Expand Down

0 comments on commit 7b6e013

Please # to comment.