Ejemplo n.º 1
0
        public void ViewModelTestDeleteAGroup()
        {
            Group m = new Group();

            m.Setup();
            m.testMode = true;
            FirstPageViewModel vm = new FirstPageViewModel(m);

            vm.NewGroup = "Test";
            FlashCard card = new FlashCard("Example question", "Example answer", "Test");

            vm.AddGroupToList();
            ListOfUniqueGroups L = new ListOfUniqueGroups();

            L.Name = "Test";
            vm.DeleteItem(L);
            bool found = false;

            foreach (FlashCard f in vm.FlashCards)
            {
                if (f.ToString() == card.ToString())
                {
                    found = true;
                }
            }
            Assert.IsFalse(found); // this should be false
        }
Ejemplo n.º 2
0
        public void ViewModelTestEditAGroup()
        {
            Group m = new Group();

            m.Setup();
            m.testMode = true;
            FirstPageViewModel vm = new FirstPageViewModel(m);

            vm.NewGroup = "Test";
            FlashCard card = new FlashCard("Example question", "Example answer", "Test");

            vm.AddGroupToList();
            ListOfUniqueGroups L = new ListOfUniqueGroups();

            vm.EditGroupName("Test", "Edit");
            bool found = false;

            foreach (FlashCard f in vm.FlashCards)
            {
                if (f.Group == card.Group)
                {
                    found = true;
                }
            }
            Assert.IsFalse(found); // this should be false
        }
Ejemplo n.º 3
0
        public void ListOfUniqueGroupsTestProperties()
        {
            ListOfUniqueGroups L = new ListOfUniqueGroups();

            L.Name = "Test";
            Assert.AreEqual(L.Name, "Test");  // should be equal
            Assert.IsFalse(L.Name != "Test"); // should be false
        }
Ejemplo n.º 4
0
        public void getListOfGroups(ObservableCollection <Model.FlashCard> flashCards)                    // used to display the group names in to the listview
        {
            ListOfGroups = new ObservableCollection <string>(flashCards.Select(f => f.Group).Distinct()); // locate all the unique group names

            if (GroupList != null)                                                                        // if the listview is full already clear it
            {
                GroupList.Clear();
            }
            foreach (string groupName in ListOfGroups) // loop through all the unique groupname to forge them into objects and add to a new list that will be shown on screen
            {
                ListOfUniqueGroups tempGroup = new ListOfUniqueGroups(groupName);
                if (GroupList == null)
                {
                    GroupList = new ObservableCollection <ListOfUniqueGroups>()
                    {
                        new ListOfUniqueGroups(groupName)
                    };
                }

                GroupList.Add(tempGroup);
            }
            _ = UpdateCloudStorage();
        }
Ejemplo n.º 5
0
        private void GroupListView_ItemTapped(object sender, ItemTappedEventArgs e)
        {
            ListOfUniqueGroups itemString = (ListOfUniqueGroups)e.Item;

            vm.NavigateToFlashCardPage(itemString.Name);
        }