mirror of
https://github.com/MirrorNetworking/Mirror.git
synced 2024-11-18 11:00:32 +00:00
Test connecting with uri
This commit is contained in:
parent
1eff4ed4e6
commit
3e0802607a
@ -1,4 +1,5 @@
|
|||||||
using System.Collections;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NSubstitute;
|
using NSubstitute;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
@ -57,5 +58,40 @@ public void TestConnect()
|
|||||||
transport1.DidNotReceive().ClientConnect(Arg.Any<string>());
|
transport1.DidNotReceive().ClientConnect(Arg.Any<string>());
|
||||||
transport2.Received().ClientConnect("some.server.com");
|
transport2.Received().ClientConnect("some.server.com");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// A Test behaves as an ordinary method
|
||||||
|
[Test]
|
||||||
|
public void TestConnectFirstUri()
|
||||||
|
{
|
||||||
|
Uri uri = new Uri("tcp://some.server.com");
|
||||||
|
|
||||||
|
transport1.Available().Returns(true);
|
||||||
|
transport2.Available().Returns(true);
|
||||||
|
|
||||||
|
transport.ClientConnect(uri);
|
||||||
|
transport1.Received().ClientConnect(uri);
|
||||||
|
transport2.DidNotReceive().ClientConnect(uri);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// A Test behaves as an ordinary method
|
||||||
|
[Test]
|
||||||
|
public void TestConnectSecondUri()
|
||||||
|
{
|
||||||
|
Uri uri = new Uri("ws://some.server.com");
|
||||||
|
|
||||||
|
transport1.Available().Returns(true);
|
||||||
|
|
||||||
|
// first transport does not support websocket
|
||||||
|
transport1
|
||||||
|
.When(x => x.ClientConnect(uri))
|
||||||
|
.Do(x => { throw new ArgumentException("Scheme not supported"); });
|
||||||
|
|
||||||
|
transport2.Available().Returns(true);
|
||||||
|
|
||||||
|
transport.ClientConnect(uri);
|
||||||
|
transport2.Received().ClientConnect(uri);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user