コード例 #1
0
        public void execute_RepresentanteNuevo_UpdateGremio()
        {
            var gremioOriginal = new Gremio(getRTN("08011985123960"), getRepresentanteLegal("0801198512396"),
                                            getDireccion("01", "01", "01", "Barrio"), "Camara");

            var nuevoGremio = new Gremio(getRTN("08011985123960"), getRepresentanteLegal("0801198411111"),
                                         getDireccion("01", "01", "01", "Barrio"), "Camara");

            var repositoryReadOnly = Mock.Of <IGremioRepositoryReadOnly>();

            Mock.Get(repositoryReadOnly).Setup(x => x.get(It.IsAny <RTN>())).Returns(gremioOriginal);

            var representanteRepository = Mock.Of <IRepresentanteLegalRepositoryReadOnly>();

            Mock.Get(representanteRepository).Setup(x => x.exists(It.IsAny <Identidad>())).Returns(false);

            var repository = Mock.Of <IGremioRepositoryCommands>();
            var uow        = Mock.Of <Func <IUnitOfWork> >();

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

            var command = new CommandUpdateGremioRepresentante(repositoryReadOnly, repository, representanteRepository,
                                                               uow);



            command.execute(nuevoGremio);


            Mock.Get(repository).Verify(x => x.updateRepresentante(It.Is <Gremio>(z => z.RepresentanteLegal == nuevoGremio.RepresentanteLegal)));
        }
コード例 #2
0
        public void isExecutable_validGremio_should_returnTrue()
        {
            var repositoryReadOnly = Mock.Of <IGremioRepositoryReadOnly>();

            Mock.Get(repositoryReadOnly).Setup(x => x.exists(Moq.It.IsAny <RTN>())).Returns(true);

            var representanteRepository = Mock.Of <IRepresentanteLegalRepositoryReadOnly>();
            var repository = Mock.Of <IGremioRepositoryCommands>();
            var uow        = Mock.Of <Func <IUnitOfWork> >();

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

            var command = new CommandUpdateGremioRepresentante(repositoryReadOnly, repository, representanteRepository,
                                                               uow);

            var gremio = new Gremio(getRTN("08011985123960"), getRepresentanteLegal("0801198512396"),
                                    getDireccion("01", "01", "01", "Barrio"), "Camara");

            var respuesta = command.isExecutable(gremio);

            Assert.IsTrue(respuesta);
        }