public void SetUp()
 {
     _mockLogger                 = new Mock <ILogger <DeleteClientCommandHandler> >();
     _mockClientService          = new Mock <IClientService>();
     _deleteClientCommandHandler = new DeleteClientCommandHandler(_mockClientService.Object, _mockLogger.Object);
     _fixture = new Fixture();
 }
コード例 #2
0
        public async Task Handle_Failed_ClientNotFound()
        {
            Random random         = new Random();
            Guid   clientSystemId = random.NextGuid();

            var repoMock = new Mock <IClientRepository>(MockBehavior.Strict);

            repoMock.Setup(x => x.CheckIfClientExists(clientSystemId)).ReturnsAsync(false).Verifiable();

            var handler = new DeleteClientCommandHandler(repoMock.Object,
                                                         Mock.Of <ILogger <DeleteClientCommandHandler> >());

            Boolean result = await handler.Handle(new DeleteClientCommand(clientSystemId), CancellationToken.None);

            Assert.False(result);

            repoMock.Verify();
        }