public void isExecutable_EmpleoNotExists_ReturnFalse()
        {
            var repositoryEmpleoRead         = Mock.Of <IEmpleoRepositoryReadOnly>();
            var repositoryEmpleoCommand      = Mock.Of <IEmpleoRepositoryCommands>();
            var repositoryBeneficiarioRead   = Mock.Of <IBeneficiarioRepositoryReadOnly>();
            var repositoryBeneficarioCommand = Mock.Of <IBeneficiarioRepositoryCommands>();
            var authenticateUser             = Mock.Of <IAuthenticateUser>();
            var uow = Mock.Of <Func <IUnitOfWork> >();

            Mock.Get(uow).Setup(x => x()).Returns(new DummyUnitOfWork());


            var ficha       = getFichaSupervisionEmpleo();
            var beneficiaro = getBeneficiario();
            var idEmpleo    = Guid.NewGuid();

            Mock.Get(authenticateUser).Setup(x => x.isValidUser(ficha.Firma.User, 1)).Returns(true);
            Mock.Get(repositoryBeneficiarioRead).Setup(x => x.exists(beneficiaro.Id)).Returns(true);
            Mock.Get(repositoryEmpleoRead).Setup(x => x.exists(idEmpleo)).Returns(false);

            var commando = new CommandInsertFichaDeSupervision(repositoryEmpleoRead, repositoryEmpleoCommand,
                                                               repositoryBeneficiarioRead, repositoryBeneficarioCommand, authenticateUser, uow);

            var resultado = commando.isExecutable(ficha, beneficiaro, idEmpleo);

            Assert.IsFalse(resultado);
        }
        public void execute_EmpleoRepositoryCalled_insertFichaSupervision()
        {
            var repositoryEmpleoRead         = Mock.Of <IEmpleoRepositoryReadOnly>();
            var repositoryEmpleoCommand      = Mock.Of <IEmpleoRepositoryCommands>();
            var repositoryBeneficiarioRead   = Mock.Of <IBeneficiarioRepositoryReadOnly>();
            var repositoryBeneficarioCommand = Mock.Of <IBeneficiarioRepositoryCommands>();
            var authenticateUser             = Mock.Of <IAuthenticateUser>();
            var uow = Mock.Of <Func <IUnitOfWork> >();

            Mock.Get(uow).Setup(x => x()).Returns(new DummyUnitOfWork());

            var ficha       = getFichaSupervisionEmpleo();
            var beneficiaro = getBeneficiario();
            var idEmpleo    = Guid.NewGuid();

            Mock.Get(authenticateUser).Setup(x => x.isValidUser(ficha.Firma.User, 1)).Returns(true);
            Mock.Get(repositoryBeneficiarioRead).Setup(x => x.exists(beneficiaro.Id)).Returns(true);
            Mock.Get(repositoryEmpleoRead).Setup(x => x.exists(idEmpleo)).Returns(true);

            var commando = new CommandInsertFichaDeSupervision(repositoryEmpleoRead, repositoryEmpleoCommand,
                                                               repositoryBeneficiarioRead, repositoryBeneficarioCommand, authenticateUser, uow);

            commando.execute(ficha, beneficiaro, idEmpleo);

            Mock.Get(repositoryEmpleoCommand).Verify(x => x.updateFromMovilVisitaSupervision(idEmpleo, ficha));
        }