예제 #1
0
        public void OrderProducts_ShouldOrdersAllProductsInOrderOfCatalogsOrdering_WhenGivenListOfProducts()
        {
            // Arrange
            List <Product> productList = new List <Product> {
                new Chair("Hünke Tünke", "Een leren stoel", 30, 30, 49.99, "unitTestImage.bmp"),
                new Sofa("Hanke hunke", "Een gele bank", 40, 80, 79.99, "unitTestImage.bmp"),
                new Chair("Hünke Tünke", "Een leren stoel", 30, 30, 49.99, "unitTestImage.bmp")
            };
            CatalogPanel      cp           = new CatalogPanel();
            CatalogController cc           = new CatalogController(new CatalogListPanel(), new DesignPanel());
            List <Product>    filteredList = new List <Product>();
            string            orderString  = "Naam: A-Z";

            // Act
            cc.currentOrdering = orderString;

            List <Product> expectedList = new List <Product>();

            expectedList = productList.OrderBy(x => x.name).ToList();
            filteredList = cc.OrderProducts(productList);

            // Assert
            for (int i = 0; i < filteredList.Count; i++)
            {
                Assert.AreEqual(filteredList[i], expectedList[i]);
            }
        }
예제 #2
0
 void Awake()
 {
     Instance = this;
     catalogButton.GetComponent <Button>().onClick.AddListener(delegate() {
         if (FileManager.Instance.GetFileReadState())
         {
             animatorState = !animatorState;
             catalogButton.SetBool("Start", animatorState);
             GetComponent <Animator>().SetBool("Start", animatorState);
         }
     });
 }
예제 #3
0
        public void RemoveNonSortedProducts_ShouldReturnListWithProductsThatHaveTheCatalogsSortTermAsTheirType_WhenGivenListOfProducts()
        {
            // Arrange
            List <Product> productList = new List <Product> {
                new Chair("Hünke Tünke", "Een leren stoel", 30, 30, 49.99, "unitTestImage.bmp"),
                new Sofa("Hanke hunke", "Een gele bank", 40, 80, 79.99, "unitTestImage.bmp"),
                new Chair("Hünke Tünke", "Een leren stoel", 30, 30, 49.99, "unitTestImage.bmp")
            };
            CatalogPanel      cp           = new CatalogPanel();
            CatalogController cc           = new CatalogController(new CatalogListPanel(), new DesignPanel());
            List <Product>    filteredList = new List <Product>();
            string            sortString   = "Sofa";

            // Act
            cc.currentSorting = sortString;
            filteredList      = cc.RemoveNonSortedProducts(productList);

            // Assert
            foreach (Product p in filteredList)
            {
                Assert.IsTrue(p.GetType().ToString() == "KantoorApplicatie.Models." + sortString);
            }
        }
예제 #4
0
        public void RemoveNonSearchedProducts_ShouldReturnListWithProductsThatHaveTheCatalogsSearchTermInTheirName_WhenGivenListOfProducts()
        {
            // Arrange
            List <Product> productList = new List <Product> {
                new Chair("Hünke Tünke", "Een leren stoel", 30, 30, 49.99, "unitTestImage.bmp"),
                new Sofa("Hanke hunke", "Een gele bank", 40, 80, 79.99, "unitTestImage.bmp"),
                new Chair("Hünke Tünke", "Een leren stoel", 30, 30, 49.99, "unitTestImage.bmp")
            };
            CatalogPanel      cp           = new CatalogPanel();
            CatalogController cc           = new CatalogController(new CatalogListPanel(), new DesignPanel());
            List <Product>    filteredList = new List <Product>();
            string            searchString = "T";

            // Act
            cc.currentSearch = searchString;
            filteredList     = cc.RemoveNonSearchedProducts(productList);

            // Assert
            foreach (Product p in filteredList)
            {
                Assert.IsTrue(p.name.Contains(searchString));
            }
        }
예제 #5
0
 public DatabaseController(CatalogPanel pp)
 {
     this.pp = pp;
 }