public async Task OrderQuantumTest(KeyPair clientKeyPair, KeyPair alphaKeyPair, ConnectionState state, Type excpectedException) { Global.AppState.State = ApplicationState.Ready; var clientConnection = new AuditorWebSocketConnection(new FakeWebSocket(), null) { ConnectionState = state }; var account = Global.AccountStorage.GetAccount(clientKeyPair); var orderEnvelope = new OrderRequest { Account = account?.Account.Id ?? 0 }.CreateEnvelope(); orderEnvelope.Sign(clientKeyPair); var orderQuantumEnvelope = new RequestQuantum { RequestEnvelope = orderEnvelope }.CreateEnvelope(); orderQuantumEnvelope.Sign(alphaKeyPair); await AssertMessageHandling(clientConnection, orderQuantumEnvelope, excpectedException); }
public async Task OrderTest(ConnectionState state, Type excpectedException) { Global.AppState.State = ApplicationState.Ready; var clientConnection = new AlphaWebSocketConnection(new FakeWebSocket(), "127.0.0.1") { ClientPubKey = TestEnvironment.Client1KeyPair.PublicKey, ConnectionState = state }; var account = Global.AccountStorage.GetAccount(TestEnvironment.Client1KeyPair); var envelope = new OrderRequest { Account = account.Account.Id, RequestId = 1 }.CreateEnvelope(); envelope.Sign(TestEnvironment.Client1KeyPair); await AssertMessageHandling(clientConnection, envelope, excpectedException); }
public async Task OrderTest(ConnectionState state, Type excpectedException) { context.AppState.State = ApplicationState.Ready; var clientConnection = new AlphaWebSocketConnection(context, new FakeWebSocket(), "127.0.0.1") { ClientPubKey = TestEnvironment.Client1KeyPair.PublicKey, ConnectionState = state }; var account = context.AccountStorage.GetAccount(TestEnvironment.Client1KeyPair); var envelope = new OrderRequest { Account = account.Account.Id, RequestId = 1 }.CreateEnvelope(); envelope.Sign(TestEnvironment.Client1KeyPair); using var writer = new XdrBufferWriter(); var inMessage = envelope.ToIncomingMessage(writer); await AssertMessageHandling(clientConnection, inMessage, excpectedException); }