Exemplo n.º 1
0
        public void ClientService_Add_ShouldFailDueInvalidClient()
        {
            // Arrage
            var client = _clientTestBogusFixture.GenerateInvalidClient();
            var mocker = new AutoMocker();

            var clientService = mocker.CreateInstance <ClientService>();

            // Act
            clientService.Add(client);

            // Assert
            mocker.GetMock <IClientService>().Verify(r => r.Add(client), Times.Never);
            mocker.GetMock <IMediator>().Verify(m => m.Publish(It.IsAny <INotification>(), CancellationToken.None), Times.Never);
        }
Exemplo n.º 2
0
        public void ClientService_Add_ShouldFailDueInvalidClient()
        {
            // Arrage
            var client     = _clientTestBogusFixture.GenerateInvalidClient();
            var clientRepo = new Mock <IClientRepository>();
            var mediator   = new Mock <IMediator>();

            var clientService = new ClientService(clientRepo.Object, mediator.Object);

            // Act
            clientService.Add(client);

            // Assert
            clientRepo.Verify(r => r.Add(client), Times.Never);
            mediator.Verify(m => m.Publish(It.IsAny <INotification>(), CancellationToken.None), Times.Never);
        }