mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Merge pull request #323 from mykolasglinskis/master
FloodExceptionShouldNotCauseCannotReadPackageLengthError
This commit is contained in:
commit
3ef3ff86ad
|
|
@ -68,5 +68,12 @@ namespace TLSharp.Tests
|
||||||
{
|
{
|
||||||
await base.CheckPhones();
|
await base.CheckPhones();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
[Ignore("FIXME")]
|
||||||
|
public override async Task FloodExceptionShouldNotCauseCannotReadPackageLengthError()
|
||||||
|
{
|
||||||
|
await base.FloodExceptionShouldNotCauseCannotReadPackageLengthError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -67,5 +67,11 @@ namespace TLSharp.Tests
|
||||||
{
|
{
|
||||||
await base.CheckPhones();
|
await base.CheckPhones();
|
||||||
}
|
}
|
||||||
|
[TestMethod]
|
||||||
|
[Ignore]
|
||||||
|
public override async Task FloodExceptionShouldNotCauseCannotReadPackageLengthError()
|
||||||
|
{
|
||||||
|
await base.FloodExceptionShouldNotCauseCannotReadPackageLengthError();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ using System.Threading.Tasks;
|
||||||
using TeleSharp.TL;
|
using TeleSharp.TL;
|
||||||
using TeleSharp.TL.Messages;
|
using TeleSharp.TL.Messages;
|
||||||
using TLSharp.Core;
|
using TLSharp.Core;
|
||||||
|
using TLSharp.Core.Network;
|
||||||
using TLSharp.Core.Requests;
|
using TLSharp.Core.Requests;
|
||||||
using TLSharp.Core.Utils;
|
using TLSharp.Core.Utils;
|
||||||
|
|
||||||
|
|
@ -330,5 +331,20 @@ namespace TLSharp.Tests
|
||||||
var result = await client.IsPhoneRegisteredAsync(NumberToAuthenticate);
|
var result = await client.IsPhoneRegisteredAsync(NumberToAuthenticate);
|
||||||
Assert.IsTrue(result);
|
Assert.IsTrue(result);
|
||||||
}
|
}
|
||||||
|
public virtual async Task FloodExceptionShouldNotCauseCannotReadPackageLengthError()
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 50; i++)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await CheckPhones();
|
||||||
|
}
|
||||||
|
catch (FloodException floodException)
|
||||||
|
{
|
||||||
|
Console.WriteLine($"FLOODEXCEPTION: {floodException}");
|
||||||
|
Thread.Sleep(floodException.TimeToWait);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue