public void TestGetTopicByName() { DataModel model = new DataModel(path) { RevisionGroups = new Dictionary <TopicSQL, ObservableCollection <RevisionCardSQL> >() }; //Topic objects and associated topic names to compare later string[] topicNames = { "Xamarin", "C#", "Java", "F#", "Python" }; TopicSQL[] topics = new TopicSQL[topicNames.Length]; //Set local dictionary for (int i = 0; i < topicNames.Length; i++) { topics[i] = new TopicSQL() { TopicName = topicNames[i] }; model.RevisionGroups.Add(topics[i], new ObservableCollection <RevisionCardSQL>()); } //Check that all topics can be retrieved by name for (int i = 0; i < topicNames.Length; i++) { var fetchedTopic = model.GetTopicByName(topicNames[i]); Assert.AreEqual(topics[i], fetchedTopic); } }
public void TestSaveTopic() { //Setup DataModel model = new DataModel(path); model.DeleteAll(); //Completely clears the data!!!! DO NOT USE IN ACTUAL CODE - TESTING METHOD model.LoadData(); Dictionary <TopicSQL, ObservableCollection <RevisionCardSQL> > test = model.RevisionGroups; TopicSQL testTopic = new TopicSQL(); testTopic.TopicName = "Xamarin"; //Test model.SaveTopic(testTopic); //Assert Assert.AreEqual(test, model.RevisionGroups); }
public ManageLoadedCardsPage(TopicSQL topic) { InitializeComponent(); vm = new ManageTopicCardsViewModel(this, topic); BindingContext = vm; }