Ejemplo n.º 1
0
        public void ChangeMaterialCategory_GetMaterialWithEditCategory_Other()
        {
            Material material = _materialService.GetMaterialById(1);

            var result = _materialService.ChangeMaterialCategory(material.Name, "Other");

            Assert.Equal("Other", result.Category);
        }
Ejemplo n.º 2
0
        public void ChangeMaterialCategory_GetMaterialWithEditCategory_Other()
        {
            var mock = new Mock <IRepository>();

            mock.Setup(repo => repo.FindByName("Test")).Returns(new Material {
                Id = 1, Name = "Test", Category = (Category)2
            });
            MaterialService materialService = new MaterialService(new ConfigurationBuilder()
                                                                  .SetBasePath(Directory.GetCurrentDirectory())
                                                                  .AddJsonFile("appsettings.json")
                                                                  .Build(), mock.Object);

            var result = materialService.ChangeMaterialCategory("Test", (Category)1);

            Assert.Equal((Category)1, result.Category);
        }
Ejemplo n.º 3
0
 public void ChangeCategory(int id, [FromForm] string category)
 {
     _materialService.ChangeMaterialCategory(id, category);
 }