Ejemplo n.º 1
0
        public void ClearAllListDepartmentTest()
        {
            Store      store       = new Store(title);
            Department department1 = new Department("Одежда");
            Department department2 = new Department("Игрушки");
            Department department3 = new Department("Бытовая техника");

            store.AddDepartment(department1);
            store.AddDepartment(department2);
            store.AddDepartment(department3);

            store.ClearAllListDepartment();

            Assert.AreEqual(0, store.GetListDepartments().Count);
        }
Ejemplo n.º 2
0
        public void GetListDepartmentTest()
        {
            Store      store       = new Store(title);
            Department department1 = new Department("Одежда");
            Department department2 = new Department("Игрушки");
            Department department3 = new Department("Бытовая техника");

            store.AddDepartment(department1);
            store.AddDepartment(department2);
            store.AddDepartment(department3);

            List <Department> departments = store.GetListDepartments();

            Assert.IsTrue(departments.Contains(department1), "Ошибка: в списке отсутствует отдел №1");
            Assert.IsTrue(departments.Contains(department2), "Ошибка: в списке отсутствует отдел №2");
            Assert.IsTrue(departments.Contains(department3), "Ошибка: в списке отсутствует отдел №3");
        }
Ejemplo n.º 3
0
        public void AddDepartmentTest()
        {
            Store      store      = new Store(title);
            Department department = new Department("Одежда");

            store.AddDepartment(department);

            Assert.IsTrue(store.GetListDepartments().Contains(department));
        }
Ejemplo n.º 4
0
 static void FileLoadStore(Store store)
 {
     using (StreamReader listDepartments = new StreamReader("Department.txt", Encoding.Default))
     {
         string str = listDepartments.ReadLine();
         while (str != null)
         {
             store.AddDepartment(new Department(str));
             str = listDepartments.ReadLine();
         }
     }
     using (StreamReader listCategories = new StreamReader("Category.txt", Encoding.Default))
     {
         string str = listCategories.ReadLine();
         while (str != null)
         {
             int      numberOfElementsInARow = 2; // Категория; Отдел
             string[] elements = new string[numberOfElementsInARow];
             elements = str.Split(';');
             store.GetListDepartments().Find(x => x.Title.Contains(elements[1])).AddCategory(new Category(elements[0]));
             str = listCategories.ReadLine();
         }
     }
 }