mirror of
https://github.com/dotnet/MQTTnet.git
synced 2026-10-16 17:23:04 +08:00
Refactorings
This commit is contained in:
@@ -9,25 +9,25 @@ namespace MQTTnet.Core.Tests
|
||||
[TestClass]
|
||||
public class ExtensionTests
|
||||
{
|
||||
[ExpectedException(typeof( MqttCommunicationTimedOutException ) )]
|
||||
[ExpectedException(typeof(MqttCommunicationTimedOutException))]
|
||||
[TestMethod]
|
||||
public async Task TestTimeoutAfter()
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(500)).TimeoutAfter(TimeSpan.FromMilliseconds(100));
|
||||
}
|
||||
|
||||
[ExpectedException(typeof( MqttCommunicationTimedOutException))]
|
||||
[ExpectedException(typeof(MqttCommunicationTimedOutException))]
|
||||
[TestMethod]
|
||||
public async Task TestTimeoutAfterWithResult()
|
||||
{
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(500)).ContinueWith(t => 5).TimeoutAfter(TimeSpan.FromMilliseconds(100));
|
||||
await Task.Delay(TimeSpan.FromMilliseconds(500)).ContinueWith(t => 5).TimeoutAfter(TimeSpan.FromMilliseconds(100));
|
||||
}
|
||||
|
||||
|
||||
[TestMethod]
|
||||
public async Task TestTimeoutAfterCompleteInTime()
|
||||
{
|
||||
var result = await Task.Delay( TimeSpan.FromMilliseconds( 100 ) ).ContinueWith( t => 5 ).TimeoutAfter( TimeSpan.FromMilliseconds( 500 ) );
|
||||
Assert.AreEqual( 5, result );
|
||||
var result = await Task.Delay(TimeSpan.FromMilliseconds(100)).ContinueWith(t => 5).TimeoutAfter(TimeSpan.FromMilliseconds(500));
|
||||
Assert.AreEqual(5, result);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,6 @@ namespace MQTTnet.TestApp.UniversalWindows
|
||||
var options = new MqttClientOptions
|
||||
{
|
||||
Server = Server.Text,
|
||||
Port = 8080,
|
||||
UserName = User.Text,
|
||||
Password = Password.Text,
|
||||
ClientId = ClientId.Text,
|
||||
|
||||
Reference in New Issue
Block a user