Exemple #1
0
        public async Task Get_Categoria()
        {
            var service = new CategoriasController(_mockContext.Object);
            await service.GetCategorias(1);

            _mockSet.Verify(m => m.FindAsync(1),
                            Times.Once());
        }
Exemple #2
0
        public void Get()
        {
            CategoriasController controller = new CategoriasController(container);

            IEnumerable <Categoria> result = controller.GetCategorias();

            Assert.IsNotNull(result);
            Assert.AreEqual(3, result.Count());
            Assert.AreEqual(1, result.ElementAt(0).Id);
            Assert.AreEqual("computador", result.ElementAt(0).Slug);
            Assert.AreEqual(2, result.ElementAt(1).Id);
            Assert.AreEqual("desktop", result.ElementAt(1).Slug);
            Assert.AreEqual(3, result.ElementAt(2).Id);
            Assert.AreEqual("laptop", result.ElementAt(2).Slug);
        }
        public void GetCategorias_DeveraRetornar_TodasAsCategorias()
        {
            var result = controller.GetCategorias() as TesteCategoriaDbSet;

            Assert.AreEqual(true, result.Local.Count == 4);
        }