Пример #1
0
        public void ClientService_GetAllActives_ShouldReturnOnlyActiveClients()
        {
            // Arrange
            var mocker        = new AutoMocker();
            var clientService = mocker.CreateInstance <ClientService>();

            mocker.GetMock <IClientRepository>().Setup(c => c.GetAll())
            .Returns(_clientTestBogusFixture.GetSomeClients());

            // Act
            var clients = clientService.GetAllActives();

            // Assert
            Assert.True(clients.Any());
            Assert.False(clients.Count(c => !c.Active) > 0);
        }
Пример #2
0
        public void ClientService_GetAllActives_ShouldReturnOnlyActiveClients()
        {
            // Arrange
            var clientRepo = new Mock <IClientRepository>();
            var mediator   = new Mock <IMediator>();

            clientRepo.Setup(c => c.GetAll())
            .Returns(_clientTestBogusFixture.GetSomeClients());

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

            // Act
            var clients = clientService.GetAllActives();

            // Assert
            Assert.True(clients.Any());
            Assert.False(clients.Count(c => !c.Active) > 0);
        }