Merge pull request #323 from mykolasglinskis/master

FloodExceptionShouldNotCauseCannotReadPackageLengthError
This commit is contained in:
Ilya Pirozhenko 2016-12-15 11:00:06 +03:00 committed by GitHub
commit 3ef3ff86ad
3 changed files with 29 additions and 0 deletions

View file

@ -68,5 +68,12 @@ namespace TLSharp.Tests
{
await base.CheckPhones();
}
[Test]
[Ignore("FIXME")]
public override async Task FloodExceptionShouldNotCauseCannotReadPackageLengthError()
{
await base.FloodExceptionShouldNotCauseCannotReadPackageLengthError();
}
}
}

View file

@ -67,5 +67,11 @@ namespace TLSharp.Tests
{
await base.CheckPhones();
}
[TestMethod]
[Ignore]
public override async Task FloodExceptionShouldNotCauseCannotReadPackageLengthError()
{
await base.FloodExceptionShouldNotCauseCannotReadPackageLengthError();
}
}
}

View file

@ -10,6 +10,7 @@ using System.Threading.Tasks;
using TeleSharp.TL;
using TeleSharp.TL.Messages;
using TLSharp.Core;
using TLSharp.Core.Network;
using TLSharp.Core.Requests;
using TLSharp.Core.Utils;
@ -330,5 +331,20 @@ namespace TLSharp.Tests
var result = await client.IsPhoneRegisteredAsync(NumberToAuthenticate);
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);
}
}
}
}
}