Пример #1
0
        public void TestStateModel()
        {
            LibraryRepository repository             = new LibraryRepository();
            ObservableCollection <StateModel> models = StateModel.GetStates();

            Assert.AreEqual(repository.GetAllStateIds().Count, models.Count);
            foreach (StateModel model in models)
            {
                Assert.IsTrue(repository.GetAllStateIds().Exists(id => id == model.Id));
            }
        }
Пример #2
0
        public void AddAndRemoveStateTest()
        {
            int int1 = repository.AddCatalog("Dune", "Frank Herbert");
            int int2 = repository.AddCatalog("Krol", "Szczepan Twardoch");
            int id1  = repository.AddState(int1, false);
            int id2  = repository.AddState(int2, false);

            Assert.AreEqual(repository.GetAllStateIds().Count, 2);
            repository.RemoveState(id1);
            repository.RemoveState(id2);
            Assert.AreEqual(repository.GetAllStateIds().Count, 0);;
        }
Пример #3
0
        public static ObservableCollection <StateModel> GetStates()
        {
            ObservableCollection <StateModel> models = new ObservableCollection <StateModel>();
            List <int> stateIDs = new List <int>();

            stateIDs = repository.GetAllStateIds();
            foreach (int id in stateIDs)
            {
                models.Add(new StateModel(id, repository.GetStateIsBorrowed(id), repository.GetStateCatalogId(id)));
            }
            return(models);
        }