Skip to content

Commit

Permalink
more fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Iulian Masar committed Feb 5, 2025
1 parent c213c0b commit 9cbc690
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 16 deletions.
20 changes: 5 additions & 15 deletions MangoPay.SDK.Tests/ApiEventsTest.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
using MangoPay.SDK.Core;
using System;
using System.Threading.Tasks;
using MangoPay.SDK.Core;
using MangoPay.SDK.Core.Enumerations;
using MangoPay.SDK.Entities;
using MangoPay.SDK.Entities.GET;
using NUnit.Framework;
using System;
using System.Threading.Tasks;

namespace MangoPay.SDK.Tests
{
Expand All @@ -28,26 +28,16 @@ public async Task Test_Events_Get()

Assert.IsNotNull(getEvents);
Assert.IsNotNull(getAllEvents);



// test sorting
ListPaginated<EventDTO> result = null;
ListPaginated<EventDTO> result2 = null;
ListPaginated<EventDTO> result;

var pagination = new Pagination(1, 2);
var sort = new Sort();
sort.AddField("CreationDate", SortDirection.asc);
result = await this.Api.Events.GetAllAsync(pagination, eventsFilter, sort);
Assert.IsNotNull(result);
Assert.IsTrue(result.Count > 0);

sort = new Sort();
sort.AddField("CreationDate", SortDirection.desc);
result2 = await this.Api.Events.GetAllAsync(pagination, eventsFilter, sort);
Assert.IsNotNull(result2);
Assert.IsTrue(result2.Count > 0);

Assert.IsTrue(result[0].ResourceId != result2[0].ResourceId);
}
catch (Exception ex)
{
Expand Down
19 changes: 18 additions & 1 deletion MangoPay.SDK.Tests/ApiRateLimitsTest.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
using System;
using System.Threading.Tasks;
using MangoPay.SDK.Core.Enumerations;
using MangoPay.SDK.Entities;
using MangoPay.SDK.Entities.POST;
using NUnit.Framework;

namespace MangoPay.SDK.Tests
Expand All @@ -14,7 +17,21 @@ public async Task Test_RateLimits_Retreive()

try
{
await this.GetJohn(true);
var user = new UserNaturalOwnerPostDTO
{
Email = "[email protected]",
FirstName = "John",
LastName = "Doe",
Birthday = new DateTime(1975, 12, 21, 0, 0, 0),
Nationality = CountryIso.FR,
CountryOfResidence = CountryIso.FR,
Occupation = "programmer",
IncomeRange = 3,
Address = new Address { AddressLine1 = "Address line 1", AddressLine2 = "Address line 2", City = "City", Country = CountryIso.PL, PostalCode = "11222", Region = "Region" }
};

await this.Api.Users.CreateOwnerAsync(user);

Assert.IsNotNull(Api.LastRequestInfo);
Assert.IsNotNull(Api.LastRequestInfo.RateLimitingCallsRemaining);
Assert.IsNotNull(Api.LastRequestInfo.RateLimitingTimeTillReset);
Expand Down

0 comments on commit 9cbc690

Please sign in to comment.