Skip to content

Commit

Permalink
feat: point test to not deprecated method
Browse files Browse the repository at this point in the history
  • Loading branch information
Dovchik committed Aug 2, 2024
1 parent 686a5e1 commit 30a887f
Showing 1 changed file with 40 additions and 35 deletions.
75 changes: 40 additions & 35 deletions tests/Sinch.Tests/e2e/NumbersTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ public class NumbersTests : TestBase
[Fact]
public async Task ListRegions()
{
var response = await SinchClientMockStudio.Numbers.Regions.List(new List<Types>() { Types.Local, Types.Mobile });
var response =
await SinchClientMockStudio.Numbers.Regions.List(new List<Types>() { Types.Local, Types.Mobile });
response = response.ToList();
response.Should().HaveCount(18);
var brRegion = response.First(x => x.RegionCode == "CL");
Expand All @@ -25,7 +26,7 @@ public async Task ListRegions()
[Fact]
public async Task Rent()
{
var response = await SinchClientMockStudio.Numbers.Available.Rent("+447520652221", new RentActiveNumberRequest()
var response = await SinchClientMockStudio.Numbers.Rent("+447520652221", new RentActiveNumberRequest()
{
SmsConfiguration = null,
VoiceConfiguration = null,
Expand All @@ -37,58 +38,62 @@ public async Task Rent()
[Fact]
public async Task ListAvailableWithPattern()
{
var response = await SinchClientMockStudio.Numbers.Available.List(new Sinch.Numbers.Available.List.ListAvailableNumbersRequest
{
RegionCode = "US",
Type = Types.Local,
NumberPattern = new NumberPattern
var response = await SinchClientMockStudio.Numbers.SearchForAvailableNumbers(
new Sinch.Numbers.Available.List.ListAvailableNumbersRequest
{
Pattern = "122",
SearchPattern = SearchPattern.End
}
});
RegionCode = "US",
Type = Types.Local,
NumberPattern = new NumberPattern
{
Pattern = "122",
SearchPattern = SearchPattern.End
}
});
response.AvailableNumbers.Should().HaveCount(5);
}

[Fact]
public async Task ListAvailableWithCapabilities()
{
var response = await SinchClientMockStudio.Numbers.Available.List(new Sinch.Numbers.Available.List.ListAvailableNumbersRequest
{
RegionCode = "US",
Type = Types.Local,
Capabilities = new List<Product>()
var response = await SinchClientMockStudio.Numbers.SearchForAvailableNumbers(
new Sinch.Numbers.Available.List.ListAvailableNumbersRequest
{
Product.Voice
}
});
RegionCode = "US",
Type = Types.Local,
Capabilities = new List<Product>()
{
Product.Voice
}
});
response.AvailableNumbers.Should().HaveCount(5);
}

[Fact]
public async Task ListActiveWithPageSize()
{
var response = await SinchClientMockStudio.Numbers.Active.List(new Sinch.Numbers.Active.List.ListActiveNumbersRequest
{
RegionCode = "GB",
Type = Types.Mobile,
PageSize = 1
});
var response = await SinchClientMockStudio.Numbers.List(
new Sinch.Numbers.Active.List.ListActiveNumbersRequest
{
RegionCode = "GB",
Type = Types.Mobile,
PageSize = 1
});
response.TotalSize.Should().Be(6);
response.ActiveNumbers.Should().HaveCount(1);
}

[Fact]
public async Task ListActiveWithPageToken()
{
var response = await SinchClientMockStudio.Numbers.Active.List(new Sinch.Numbers.Active.List.ListActiveNumbersRequest
{
RegionCode = "GB",
Type = Types.Mobile,
PageSize = 1,
PageToken =
"CgtwaG9uZU51bWJlchJoCjl0eXBlLmdvb2dsZWFwaXMuY29tL3NpbmNoLnVuaWZpZWRudW1iZXIudjEuTnVtYmVyUGFnZU1hcmsSKwoaMDFnZTI0Z3JwejFjcXcyN2c4MnBoZnEzN3oSDSs0NDc1MjA2NTI2NDI=",
});
var response = await SinchClientMockStudio.Numbers.List(
new Sinch.Numbers.Active.List.ListActiveNumbersRequest
{
RegionCode = "GB",
Type = Types.Mobile,
PageSize = 1,
PageToken =
"CgtwaG9uZU51bWJlchJoCjl0eXBlLmdvb2dsZWFwaXMuY29tL3NpbmNoLnVuaWZpZWRudW1iZXIudjEuTnVtYmVyUGFnZU1hcmsSKwoaMDFnZTI0Z3JwejFjcXcyN2c4MnBoZnEzN3oSDSs0NDc1MjA2NTI2NDI=",
});
response.TotalSize.Should().Be(6);
response.ActiveNumbers.Should().HaveCount(1);
response.NextPageToken.Should().BeEmpty();
Expand All @@ -97,14 +102,14 @@ public async Task ListActiveWithPageToken()
[Fact]
public async Task GetActive()
{
var response = await SinchClientMockStudio.Numbers.Active.Get("+447520650626");
var response = await SinchClientMockStudio.Numbers.Get("+447520650626");
response.ExpireAt.Should().Be(8.October(2022).At(7, 52, 49, 454));
}

[Fact]
public async Task Release()
{
var response = await SinchClientMockStudio.Numbers.Active.Release("+447520650626");
var response = await SinchClientMockStudio.Numbers.Release("+447520650626");
response.PhoneNumber.Should().Be("+447520650626");
}
}
Expand Down

0 comments on commit 30a887f

Please sign in to comment.