예제 #1
0
        public void DelayAsync_With_Expression_Dispatches_Correctly()
        {
            var taskName  = "task";
            var queueName = "queue";
            var left      = 5;
            var right     = 6;

            var definition = new TaskDefinition(taskName, _syncTestMethod, queueName);

            _mockDispatcher.Setup(dispatcher => dispatcher.SendMessageAsync(
                                      TaskService.MessageType,
                                      It.Is <Dictionary <string, object> >(args => (int)args["left"] == left && (int)args["right"] == right),
                                      It.IsAny <DispatchOptions>()))
            .Returns(Task.FromResult(new QueueTMessage {
            }))
            .Verifiable();

            _taskRegistry.AddTask(definition);
            var message = _taskService.DelayAsync <TestTaskClass>(c => c.Multiply(5, 6)).Result;

            _mockDispatcher.Verify();
        }
예제 #2
0
 public void AddTask_Throws_On_Null_TaskDefinition()
 {
     Assert.Throws <ArgumentNullException>(() => _taskRegistry.AddTask(null));
 }