Exemplo n.º 1
0
        public void TestCreateMateriais()
        {
            ApplicationDbContext controller;

            controller = GetContextWithoutData();
            MateriaisController material_controller = new MateriaisController(controller);

            //MaterialId, Categoria, EspermogramaId, Lote, Nome, QuantidadeUtilizada
            var materialToAdd = new Material
            {
                MaterialId          = 1,
                Categoria           = CategoriaEnum.Laboratorial,
                EspermogramaId      = 1,
                Lote                = "2",
                Nome                = "luva",
                QuantidadeUtilizada = 2
            };

            // Act
            var actionResultTask = material_controller.Create(materialToAdd);

            controller.Add(materialToAdd);

            // Assert
            Assert.True(actionResultTask.IsCompletedSuccessfully);
        }
Exemplo n.º 2
0
        public void TestIndexMateriais()
        {
            // Arrange
            ApplicationDbContext controller;

            controller = GetContextWithoutData();
            MateriaisController material_controller = new MateriaisController(controller);

            // Act
            var actionResultTask = material_controller.Index();

            actionResultTask.Wait();
            var viewResult = actionResultTask.Result as ViewResult;

            // Assert
            Assert.NotNull(viewResult);
            Assert.NotNull(viewResult.Model); // add additional checks on the Model
            Assert.True(string.IsNullOrEmpty(viewResult.ViewName) || viewResult.ViewName == "Index");
        }