public void EndSignInvalidAsyncResultTest() { TcpKsiSigningServiceProtocol protocol = new TcpKsiSigningServiceProtocol(new IPAddress(new byte[] { 127, 0, 0, 1 }), 0); KsiServiceProtocolException ex = Assert.Throws <KsiServiceProtocolException>(delegate { protocol.EndSign(new TestAsyncResult()); }); Assert.That(ex.Message.StartsWith("Invalid IAsyncResult"), "Unexpected exception message: " + ex.Message); }
public void EndSignWithAsyncResultDisposedTest() { TcpKsiSigningServiceProtocol protocol = new TcpKsiSigningServiceProtocol(new IPAddress(new byte[] { 127, 0, 0, 1 }), 0); KsiServiceAsyncResult asyncResult = new TcpKsiServiceAsyncResult(KsiServiceRequestType.Sign, new byte[] { 1, 2, 3 }, 12345, null, null); asyncResult.Dispose(); KsiServiceProtocolException ex = Assert.Throws <KsiServiceProtocolException>(delegate { protocol.EndSign(asyncResult); }); Assert.That(ex.Message.StartsWith("Provided async result is already disposed. Possibly using the same async result twice when ending request"), "Unexpected exception message: " + ex.Message); }