예제 #1
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));
		}
예제 #3
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));
        }
예제 #4
0
        public void ForCommand_WhenRegisteringCommandTypeTwice_ShouldThrow(
            [Frozen] Mock <IAsyncCommandBus> mockCommandBus,
            ConcurrencyExecutionAsyncCommandBus sut,
            IAsyncCommand command)
        {
            //arrange
            sut.ForCommand <TestCommand>(1);

            //act
            Action action = () => sut.ForCommand <TestCommand>(1);

            //assert
            action.ShouldThrow <ArgumentException>();
        }
		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));
		}
예제 #6
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));
        }
		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));
		}
예제 #8
0
 public void Sut_ShouldBeAsyncCommandBus(ConcurrencyExecutionAsyncCommandBus sut)
 {
     sut.Should().BeAssignableTo <IAsyncCommandBus>();
 }
		public void Sut_ShouldBeAsyncCommandBus(ConcurrencyExecutionAsyncCommandBus sut)
		{
			sut.Should().BeAssignableTo<IAsyncCommandBus>();
		}
		public void ForCommand_WhenRegisteringCommandTypeTwice_ShouldThrow(
			[Frozen]Mock<IAsyncCommandBus> mockCommandBus,
			ConcurrencyExecutionAsyncCommandBus sut,
			IAsyncCommand command)
		{
			//arrange
			sut.ForCommand<TestCommand>(1);

			//act
			Action action = () => sut.ForCommand<TestCommand>(1);

			//assert
			action.ShouldThrow<ArgumentException>();
		}