示例#1
0
        public async Task Command_ShouldBeCalledOnce()
        {
            var command = new TestAsyncCommand();

            await mediator.ExecuteAsync(command);

            command.EngineInvocationCount.ShouldBe(1);
        }
示例#2
0
        public void CancellationToken_ShouldReturnCorrectValue(
            )
        {
            //arrange
            var source = new CancellationTokenSource();
            var sut    = new TestAsyncCommand(source.Token);

            //act
            source.Cancel();

            //assert
            sut.CancellationToken.IsCancellationRequested.Should().BeTrue();
        }
示例#3
0
		public void CancellationToken_ShouldReturnCorrectValue(
			)
		{
			//arrange
			var source = new CancellationTokenSource();
			var sut = new TestAsyncCommand(source.Token);

			//act
			source.Cancel();

			//assert
			sut.CancellationToken.IsCancellationRequested.Should().BeTrue();
		}
示例#4
0
        public async Task Finds_And_Executed_Async_Handler_For_Command()
        {
            // Given
            var command = new TestAsyncCommand
            {
                HasBeenCalled = false
            };

            // When
            await _broker.ProcessCommandAsync(command);

            // Then
            command.HasBeenCalled.ShouldBeTrue();
        }