public void TestAddGroup() { //string name1 = _uniqueNames.Pop(); string name1; _uniqueNames.TryPop(out name1); IGroupModel group1 = _modelFactory.GetGroupModel(name1, UniversalConstants.CountSize); _groupStore.Add(group1); //string name2 = _uniqueNames.Pop(); string name2; _uniqueNames.TryPop(out name2); IGroupModel group2 = _modelFactory.GetGroupModel(name2, UniversalConstants.CountSize); _groupStore.Add(group2); _groupStore.AddItem(group1, group2); group1 = _groupStore.GetOne(x => x.Name == name1); List <ITextOrGroupViewModel> groupMembers = group1.GetMembers(); Assert.AreEqual(1, groupMembers.Count); Assert.AreEqual(name2, groupMembers[0].GetName()); Assert.IsInstanceOfType(groupMembers[0], typeof(IGroupModel)); _groupStore.RemoveItem(group1, group2); _groupStore.Delete(group2); _groupStore.Delete(group1); }
public void TestAddText() { string groupName; _uniqueNames.TryPop(out groupName); //string groupName = _uniqueNames.Pop(); IGroupModel groupModel = _modelFactory.GetGroupModel(groupName, UniversalConstants.CountSize); _groupStore.Add(groupModel); //string textName = _uniqueNames.Pop(); string textName; _uniqueNames.TryPop(out textName); StreamReader text = new StreamReader("../../SampleTextFiles/WordSpanningMultipleLines.txt"); ITextModel textModel = _modelFactory.GetTextModel(textName, text, UniversalConstants.CountSize); _textStore.Add(textModel); _groupStore.AddItem(groupModel, textModel); groupModel = _groupStore.GetOne(x => x.Name == groupName); List <ITextOrGroupViewModel> groupMembers = groupModel.GetMembers(); Assert.AreEqual(1, groupMembers.Count); Assert.AreEqual(textName, groupMembers[0].GetName()); Assert.IsInstanceOfType(groupMembers[0], typeof(ITextModel)); CompareTextModels(textModel, (ITextModel)groupMembers[0]); _groupStore.RemoveItem(groupModel, textModel); _textStore.Delete(textModel); _groupStore.Delete(groupModel); }