Exemple #1
0
        public void RetornoIgrejaCategorias()
        {
            var listaCategoriasViewModel = new List <CategoriaViewModel>()
            {
                new CategoriaViewModel(Guid.NewGuid(), "Evangelico")
            };

            var listaCategoria = new List <CategoriaIgreja>()
            {
                new CategoriaIgreja(TipoCategoriaEnum.Evangelica)
                {
                    Id = Guid.NewGuid()
                }
            };


            Moq.Mock <IAplicationCategoriaIgrejaAppService> mockAplication = new Moq.Mock <IAplicationCategoriaIgrejaAppService>();
            mockAplication.Setup(x => x.ObterCategorias()).Returns(Task.FromResult <IList <CategoriaViewModel> >(listaCategoriasViewModel));

            Moq.Mock <IUnitOfWork <CategoriaIgreja> > mockPattern = new Moq.Mock <IUnitOfWork <CategoriaIgreja> >();
            mockPattern.Setup(x => x.Repository.All()).Returns(Task.FromResult <IList <CategoriaIgreja> >(listaCategoria));

            var pattern = new AplicationCategoriaIgrejaAppService(mockPattern.Object);

            var result = pattern.ObterCategorias();

            Assert.Equal(result.Result.Any(), listaCategoriasViewModel.Any());
        }
Exemple #2
0
        public void VerificandoMensagemDeExessao()
        {
            var listaCategoria = new List <CategoriaIgreja>()
            {
            };

            Moq.Mock <IAplicationCategoriaIgrejaAppService> mockAplication = new Moq.Mock <IAplicationCategoriaIgrejaAppService>();

            Moq.Mock <IUnitOfWork <CategoriaIgreja> > mockPattern = new Moq.Mock <IUnitOfWork <CategoriaIgreja> >();
            mockPattern.Setup(x => x.Repository.All()).Returns(Task.FromResult <IList <CategoriaIgreja> >(listaCategoria));

            var pattern = new AplicationCategoriaIgrejaAppService(mockPattern.Object);

            var result = pattern.ObterCategorias().Exception.InnerException.Message;

            Assert.Equal("Não foram encontradas categorias cadastradas", result);
        }
Exemple #3
0
        public void ExecptionRetornoIgrejaCategorias()
        {
            var listaCategoria = new List <CategoriaIgreja>()
            {
            };

            Moq.Mock <IAplicationCategoriaIgrejaAppService> mockAplication = new Moq.Mock <IAplicationCategoriaIgrejaAppService>();

            Moq.Mock <IUnitOfWork <CategoriaIgreja> > mockPattern = new Moq.Mock <IUnitOfWork <CategoriaIgreja> >();
            mockPattern.Setup(x => x.Repository.All()).Returns(Task.FromResult <IList <CategoriaIgreja> >(listaCategoria));

            var pattern = new AplicationCategoriaIgrejaAppService(mockPattern.Object);

            var result = pattern.ObterCategorias();

            Assert.ThrowsAny <DomainException>(() => throw new DomainException("Não foram encontradas categorias cadastradas"));
        }