Beispiel #1
0
        public async Task Process_ShouldRunCorrectNumberOfConcurrentInnerProcessCommand(
            [Frozen] Mock <IAsyncCommandBus> mockCommandBus,
            ConcurrencyExecutionAsyncCommandBus sut,
            TestCommand command)
        {
            //arrange
            mockCommandBus.Setup(m => m.ProcessCommand(It.IsAny <TestCommand>()))
            .ReturnsDefaultTask();
            sut.ForCommand <TestCommand>(1);

            //act
            var t1 = Task.Run(() => sut.ProcessCommand(command));
            var t2 = Task.Run(() => sut.ProcessCommand(command));
            await Task.WhenAll(t1, t2);

            //assert
            mockCommandBus.Verify(m => m.ProcessCommand(command), Times.Exactly(2));
        }
Beispiel #2
0
        public async Task Process_ShouldCallInnerProcessCommand(
            [Frozen] Mock <IAsyncCommandBus> mockCommandBus,
            ConcurrencyExecutionAsyncCommandBus sut,
            IAsyncCommand command)
        {
            //act
            await sut.ProcessCommand(command);

            //assert
            mockCommandBus.Verify(m => m.ProcessCommand(command));
        }
		public async Task Process_ShouldCallInnerProcessCommand(
			[Frozen]Mock<IAsyncCommandBus> mockCommandBus,
			ConcurrencyExecutionAsyncCommandBus sut,
			IAsyncCommand command)
		{
			//act
			await sut.ProcessCommand(command);

			//assert
			mockCommandBus.Verify(m => m.ProcessCommand(command));
		}
Beispiel #4
0
        public async Task Process_WhenRegisteringCommandType_ShouldCallInnerProcessCommand(
            [Frozen] Mock <IAsyncCommandBus> mockCommandBus,
            ConcurrencyExecutionAsyncCommandBus sut,
            IAsyncCommand command)
        {
            //arrange
            sut.ForCommand <TestCommand>(1);

            //act
            await sut.ProcessCommand(command);

            //assert
            mockCommandBus.Verify(m => m.ProcessCommand(command));
        }
		public async Task Process_WhenRegisteringCommandType_ShouldCallInnerProcessCommand(
			[Frozen]Mock<IAsyncCommandBus> mockCommandBus,
			ConcurrencyExecutionAsyncCommandBus sut,
			IAsyncCommand command)
		{
			//arrange
			sut.ForCommand<TestCommand>(1);

			//act
			await sut.ProcessCommand(command);

			//assert
			mockCommandBus.Verify(m => m.ProcessCommand(command));
		}
		public async Task Process_ShouldRunCorrectNumberOfConcurrentInnerProcessCommand(
			[Frozen]Mock<IAsyncCommandBus> mockCommandBus,
			ConcurrencyExecutionAsyncCommandBus sut,
			TestCommand command)
		{
			//arrange
			mockCommandBus.Setup(m => m.ProcessCommand(It.IsAny<TestCommand>()))
				.ReturnsDefaultTask();
			sut.ForCommand<TestCommand>(1);

			//act
			var t1 = Task.Run(() => sut.ProcessCommand(command));
			var t2 = Task.Run(() => sut.ProcessCommand(command));
			await Task.WhenAll(t1, t2);

			//assert
			mockCommandBus.Verify(m => m.ProcessCommand(command), Times.Exactly(2));
		}