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 }
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 }
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 }
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(); }
private void GroupListView_ItemTapped(object sender, ItemTappedEventArgs e) { ListOfUniqueGroups itemString = (ListOfUniqueGroups)e.Item; vm.NavigateToFlashCardPage(itemString.Name); }