private OpenConnection ( IConnection connection, string data, |
||
connection | IConnection | |
data | string | |
disconnectToken | ||
reconnecting | bool | |
리턴 | void |
public void CancelledTaskHandledinServerSentEvents() { var tcs = new TaskCompletionSource<IResponse>(); var wh = new TaskCompletionSource<Exception>(); tcs.TrySetCanceled(); var httpClient = new Mock<Microsoft.AspNet.SignalR.Client.Http.IHttpClient>(); var connection = new Mock<Microsoft.AspNet.SignalR.Client.IConnection>(); httpClient.Setup(c => c.Get(It.IsAny<string>(), It.IsAny<Action<Client.Http.IRequest>>(), It.IsAny<bool>())) .Returns(tcs.Task); connection.SetupGet(c => c.ConnectionToken).Returns("foo"); var sse = new ServerSentEventsTransport(httpClient.Object); sse.OpenConnection(connection.Object, (ex) => { wh.TrySetResult(ex); }); Assert.True(wh.Task.Wait(TimeSpan.FromSeconds(5))); Assert.IsType(typeof(OperationCanceledException), wh.Task.Result); }