コード例 #1
0
        public async Task IF_command_handler_cannot_be_found_SHOULD_throw()
        {
            //Arrange
            MockResolverContext.With_Service <IVoidAuthenticatedCommandHandler <TestCommand, IAuthenticatedUser> >(null);

            //Act
            Assert.ThrowsAsync <ArgumentException>(async() =>
                                                   await Sut.HandleAsync <TestCommand>(MockResolverContext.Object, CancellationToken.None));
        }
コード例 #2
0
        public override void Setup()
        {
            base.Setup();

            _command = new TestCommand {
                Name = "Piet"
            };
            MockCommandHandler.Mock.Setup(x => x.HandleAsync(It.IsAny <TestCommand>(), It.IsAny <IAuthenticatedUser>(), It.IsAny <CancellationToken>()))
            .ReturnsAsync(Response.Success());
            MockResolverContext.With_Service(MockCommandHandler.Object);
            MockResolverContext.With_Command_Argument(_command);
        }
 public override void Setup()
 {
     base.Setup();
     _command = new TestCommand  {
         Name = "Piet"
     };
     _mockTestCommandHandler = new TestAuthenticatedUserCommandHandlerMockBuilder()
                               .Where_HandleAsync_returns(new TestServerPayload {
         Name = "Freddie"
     });
     MockResolverContext.With_Service(_mockTestCommandHandler.Object);
     MockResolverContext.With_Command_Argument(_command);
     Services.AddSingleton(_mockTestCommandHandler.Object);
 }