Beispiel #1
0
        public static async Task ExecuteCommandsWithNoResults()
        {
            ICommandDispatcher    dispatcher = ConfigureNoResult();
            SimpleCommandNoResult command    = new SimpleCommandNoResult();
            Stopwatch             sw         = Stopwatch.StartNew();

            for (int index = 0; index < CommandsToExecute; index++)
            {
                await dispatcher.DispatchAsync(command);
            }
            sw.Stop();
            System.Console.WriteLine($"Took {sw.ElapsedMilliseconds}ms");
        }
        public async Task ExecutesCancellableHandlerWithNoResult()
        {
            // Arrange
            CommandHandlerExecuter testSubject = new CommandHandlerExecuter();
            CancellableSimpleCommandNoResultHandler handler = new CancellableSimpleCommandNoResultHandler();
            SimpleCommandNoResult command = new SimpleCommandNoResult();

            testSubject.CompileHandlerExecuter(typeof(SimpleCommandNoResult), typeof(CancellableSimpleCommandNoResultHandler));

            // Act
            await testSubject.ExecuteAsync(handler, new NoResultCommandWrapper(command), null, CancellationToken.None);

            // Assert
            Assert.True(command.WasHandled);
        }