public void QuandIdForExistenteDeveChamarObtemCategoriaPorIdUmaUnicaVez()
        {
            var idCategoria = 20;
            var comando     = new ObtemCategoriaPorId(idCategoria);
            var mock        = new Mock <IRepositorioTarefas>();
            var repo        = mock.Object;
            var handler     = new ObtemCategoriaPorIdHandler(repo);

            handler.Execute(comando);

            mock.Verify(x => x.ObtemCategoriaPorId(idCategoria), Times.Once());
        }
Esempio n. 2
0
        public void QuandoIdExistenteDeveChamarSomenteUmaVez()
        {
            var idCategoria = 20;
            var comando     = new ObtemCategoriaPorId(idCategoria);

            var mock = new Mock <IRepositorioTarefas>();
            var repo = mock.Object;

            var handler = new ObtemCategoriaPorIdHandler(repo);

            handler.Execute(comando);

            mock.Verify(r => r.ObtemCategoriaPorId(idCategoria), Times.Once);
        }
Esempio n. 3
0
        public void QuandoIdForExistenteDeveRerotnarCategoriaPorIdUmaUnicaVez()
        {
            //arrange
            var idCategoria = 20;
            var comando     = new ObtemCategoriaPorId(idCategoria);
            var mock        = new Mock <IRepositorioTarefas>();
            var repo        = mock.Object;
            var handler     = new ObtemCategoriaPorIdHandler(repo);

            //act
            handler.Execute(comando);

            //assert
            mock.Verify(r => r.ObtemCategoriaPorId(idCategoria), Times.Once());
        }
Esempio n. 4
0
        public void QuandoIdCategoriaExistirDeveChamarObtemCategoriaPorIdApenasUmaVez()
        {
            //arrnage
            var idCategoria = 20;
            var comando     = new ObtemCategoriaPorId(idCategoria);
            var mock        = new Mock <IRepositorioTarefas>();
            var repo        = mock.Object;
            var handler     = new ObtemCategoriaPorIdHandler(repo);

            //act
            handler.Execute(comando);

            //asset
            mock.Verify(r => r.ObtemCategoriaPorId(idCategoria), Times.Once());
        }
        public void QuandoForExistenteDeveChamarObtemCategoriaPorIdUmaUnicaVez()
        {
            var mock = new Mock <IRepositorioTarefas>();
            var repo = mock.Object;

            //Arrange
            var comando = new ObtemCategoriaPorId(20);
            var handler = new ObtemCategoriaPorIdHandler(repo);

            //Act
            handler.Execute(comando);

            //Assert
            mock.Verify(r => r.ObtemCategoriaPorId(20), Times.Once);
        }
Esempio n. 6
0
        public void DeveChamarObtemCategoriaPorIdUmaUnicaVez()
        {
            //arrange
            var categoraiId        = 10;
            var mock               = new Mock <IRepositorioTarefas>();
            var repositorioTarefas = mock.Object;

            var command = new ObtemCategoriaPorId(categoraiId);
            var handle  = new ObtemCategoriaPorIdHandler(repositorioTarefas);

            //action
            handle.Execute(command);

            //assert
            mock.Verify(r => r.ObtemCategoriaPorId(categoraiId), Times.Once());
        }
Esempio n. 7
0
        public void QuandoForChamadoDeveInvocarObtemCategoriaPorIdNoRepositorio()
        {
            //arrange
            var idCategoria = 20;

            var mock = new Mock <IRepositorioTarefas>();
            var repo = mock.Object;

            var comando = new ObtemCategoriaPorId(idCategoria);
            var handler = new ObtemCategoriaPorIdHandler(repo);

            //act
            handler.Execute(comando);

            //assert
            mock.Verify(r => r.ObtemCategoriaPorId(idCategoria), Times.Once());
        }
Esempio n. 8
0
        public void QuandoPassarUmIdDeveChamarUmaUnicaVez()
        {
            var idCategoria = 20;

            var command = new ObtemCategoriaPorId(idCategoria);


            var mock = new Mock <IRepositorioTarefas>();

            var repo = mock.Object;

            var handler = new ObtemCategoriaPorIdHandler(repo);


            handler.Execute(command);



            mock.Verify(r => r.ObtemCategoriaPorId(idCategoria), Times.Once());
        }