mirror of
https://github.com/JKorf/CryptoExchange.Net.git
synced 2026-08-11 16:32:57 +00:00
Squashed commit of the following:
commit0571ed17a0Author: JKorf <jankorf91@gmail.com> Date: Sun Jul 10 19:56:27 2022 +0200 Fixed tests commit99c331b389Author: JKorf <jankorf91@gmail.com> Date: Sun Jul 10 16:41:14 2022 +0200 Updated version commit70f8bd203aAuthor: JKorf <jankorf91@gmail.com> Date: Sun Jul 10 16:36:00 2022 +0200 Finished up websocket refactoring commit89b517c936Author: JKorf <jankorf91@gmail.com> Date: Fri Jul 8 20:24:58 2022 +0200 wip commit91e33cc42cAuthor: JKorf <jankorf91@gmail.com> Date: Thu Jul 7 22:17:55 2022 +0200 wip
This commit is contained in:
@@ -13,6 +13,8 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations
|
||||
public bool Connected { get; set; }
|
||||
|
||||
public event Action OnClose;
|
||||
public event Action OnReconnected;
|
||||
public event Action OnReconnecting;
|
||||
public event Action<string> OnMessage;
|
||||
public event Action<Exception> OnError;
|
||||
public event Action OnOpen;
|
||||
@@ -93,6 +95,7 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations
|
||||
{
|
||||
Connected = false;
|
||||
DisconnectTime = DateTime.UtcNow;
|
||||
Reconnecting = true;
|
||||
OnClose?.Invoke();
|
||||
}
|
||||
|
||||
@@ -115,11 +118,6 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations
|
||||
{
|
||||
OnError?.Invoke(error);
|
||||
}
|
||||
|
||||
public async Task ProcessAsync()
|
||||
{
|
||||
while (Connected)
|
||||
await Task.Delay(50);
|
||||
}
|
||||
public Task ReconnectAsync() => Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,13 +22,13 @@ namespace CryptoExchange.Net.UnitTests.TestImplementations
|
||||
{
|
||||
SubClient = new TestSubSocketClient(exchangeOptions, exchangeOptions.SubOptions);
|
||||
SocketFactory = new Mock<IWebsocketFactory>().Object;
|
||||
Mock.Get(SocketFactory).Setup(f => f.CreateWebsocket(It.IsAny<Log>(), It.IsAny<string>())).Returns(new TestSocket());
|
||||
Mock.Get(SocketFactory).Setup(f => f.CreateWebsocket(It.IsAny<Log>(), It.IsAny<WebSocketParameters>())).Returns(new TestSocket());
|
||||
}
|
||||
|
||||
public TestSocket CreateSocket()
|
||||
{
|
||||
Mock.Get(SocketFactory).Setup(f => f.CreateWebsocket(It.IsAny<Log>(), It.IsAny<string>())).Returns(new TestSocket());
|
||||
return (TestSocket)CreateSocket("123");
|
||||
Mock.Get(SocketFactory).Setup(f => f.CreateWebsocket(It.IsAny<Log>(), It.IsAny<WebSocketParameters>())).Returns(new TestSocket());
|
||||
return (TestSocket)CreateSocket("https://localhost:123/");
|
||||
}
|
||||
|
||||
public CallResult<bool> ConnectSocketSub(SocketConnection sub)
|
||||
|
||||
Reference in New Issue
Block a user