public async Task Details_RetunrsViewResult_WhenProductTypeExists()
        {
            var connection = new SqliteConnection("DataSource=:memory:");

            connection.Open();
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseSqlite(connection)
                          .Options;

            using (var context = new ApplicationDbContext(options))
            {
                context.Database.EnsureCreated();
                context.ProductType.Add(new ProductType {
                    Nome = "Saúde"
                });
                context.SaveChanges();
            }
            using (var context = new ApplicationDbContext(options))
            {
                var controller = new ProductTypeController(context);

                var result = await controller.Details(1);

                var viewResult = Assert.IsType <ViewResult>(result);
                var model      = Assert.IsAssignableFrom <ProductType>(viewResult.ViewData.Model);
                Assert.Equal(1, model.ProductTypeID);
            }
        }
        public async Task Details_ReturnsNotFoundResult_WhenIdIsNull()
        {
            var connection = new SqliteConnection("DataSource=:memory:");

            connection.Open();
            var options = new DbContextOptionsBuilder <ApplicationDbContext>()
                          .UseSqlite(connection)
                          .Options;

            using (var context = new ApplicationDbContext(options))
            {
                context.Database.EnsureCreated();
                context.SaveChanges();
            }
            using (var context = new ApplicationDbContext(options))
            {
                var controller = new ProductTypeController(context);

                var result = await controller.Details(null);

                Assert.IsType <NotFoundResult>(result);
            }
        }