public void CreateTaskToSameConnectionTest() { Assert.Empty(manager.Object.TaskList.Values); service = new WebSocketService.WebSocketService(manager.Object, serializer.Object, context.Object) { Path = "/test", ConnectionId = guid }; manager.Object.Connections.TryAdd(guid, connection.Object); var id = service.CreateTask <WebSocketService.WebSocketService>(LongTaskAsync); var id2 = service.CreateTask <WebSocketService.WebSocketService>(LongTaskAsync); Assert.NotEmpty(manager.Object.TaskList.Values); Assert.Equal(2, manager.Object.TaskList.SelectMany(s => s.Value).Count()); Assert.NotNull(manager.Object.TaskList.SelectMany(s => s.Value).First(s => s.TaskId == id)); Assert.NotNull(manager.Object.TaskList.SelectMany(s => s.Value).First(s => s.TaskId == id2)); }
public void CreateTaskFailTest() { Assert.Throws <ArgumentNullException>(() => service.CreateTask <WebSocketService.WebSocketService>(LongTaskAsync)); Assert.Empty(manager.Object.TaskList.Values); }