コード例 #1
0
        public void TestModifyIncludeQuotes()
        {
            //string name = _uniqueNames.Pop();
            string name;

            _uniqueNames.TryPop(out name);
            StreamReader sr    = new StreamReader("../../SampleTextFiles/WordSpanningMultipleLines.txt");
            ITextModel   model = _modelFactory.GetTextModel(name, sr, UniversalConstants.CountSize);

            model.SetIncludeQuotes(true);
            _textStore.Add(model);
            model = _textStore.GetOne(x => x.Name == name);
            Assert.IsTrue(model.GetIncludeQuotes());
            _textStore.ModifyIncludeQuotes(model, false);
            model = _textStore.GetOne(x => x.Name == name);
            Assert.IsFalse(model.GetIncludeQuotes());
            _textStore.Delete(model);
        }
コード例 #2
0
        private void CompareTextModels(ITextModel model1, ITextModel model2)
        {
            Assert.AreEqual(model1.GetName(), model2.GetName());
            Assert.AreEqual(model1.GetAuthor(), model2.GetAuthor());
            Assert.AreEqual(model1.GetIncludeQuotes(), model2.GetIncludeQuotes());
            ISingleWordCountModel counts1        = model1.GetCounts();
            ISingleWordCountModel counts2        = model1.GetCounts();
            ISingleWordCountModel withQuotes1    = model1.GetCountsWithQuotes();
            ISingleWordCountModel withQuotes2    = model2.GetCountsWithQuotes();
            ISingleWordCountModel withoutQuotes1 = model1.GetCountsWithoutQuotes();
            ISingleWordCountModel withoutQuotes2 = model2.GetCountsWithoutQuotes();

            for (int i = 0; i < withQuotes1.GetLength(); i++)
            {
                Assert.AreEqual(counts1.GetAt(i), counts2.GetAt(i));
                Assert.AreEqual(withQuotes1.GetAt(i), withQuotes2.GetAt(i));
                Assert.AreEqual(withoutQuotes1.GetAt(i), withoutQuotes2.GetAt(i));
            }
            Assert.AreEqual(model1.GetLength(), model2.GetLength());
        }