コード例 #1
0
        private MockText AddMockText(MockTextRepository mockTextRep, InterestingTextList testObj)
        {
            var newText = new MockText();

            mockTextRep.m_texts.Add(newText);
            testObj.PropChanged(newText.Hvo, TextTags.kflidContents, 0, 1, 0);
            return(newText);
        }
コード例 #2
0
        private MockTextRepository MakeMockTextRepoWithTwoMockTexts()
        {
            var mockTextRep = new MockTextRepository();
            var mockText1   = new MockText();
            var mockText2   = new MockText();

            mockTextRep.m_texts.Add(mockText1);
            mockTextRep.m_texts.Add(mockText2);
            return(mockTextRep);
        }
コード例 #3
0
        public void ReplaceCoreText()
        {
            MockTextRepository mockTextRepo = MakeMockTextRepoWithTwoMockTexts();
            var      testObj     = new InterestingTextList(m_propertyTable, mockTextRepo, m_mockStTextRepo);
            var      firstStText = testObj.InterestingTexts.First();
            MockText firstText   = firstStText.Owner as MockText;
            var      replacement = new MockStText();

            testObj.InterestingTextsChanged += TextsChangedHandler;
            firstText.ContentsOA             = replacement;
            testObj.PropChanged(firstText.Hvo, TextTags.kflidContents, 0, 1, 1);

            VerifyList(CurrentTexts(mockTextRepo),
                       testObj.InterestingTexts, "texts after replace");
            // Various possibilities could be valid for the arguments...for now just verify we got something.
            Assert.That(m_lastTextsChangedArgs, Is.Not.Null);
        }
コード例 #4
0
        public void AddAndRemoveCoreTexts()
        {
            MockTextRepository mockTextRep = MakeMockTextRepoWithTwoMockTexts();
            var testObj = new InterestingTextList(m_propertyTable, mockTextRep, m_mockStTextRepo);

            Assert.AreEqual(0, testObj.ScriptureTexts.Count());
            testObj.InterestingTextsChanged += TextsChangedHandler;
            MockText newText = AddMockText(mockTextRep, testObj);

            VerifyList(CurrentTexts(mockTextRep),
                       testObj.InterestingTexts, "texts from initial list of two");
            VerifyTextsChangedArgs(2, 1, 0);
            var removed = mockTextRep.m_texts[1].ContentsOA;

            RemoveText(mockTextRep, testObj, 1);
            VerifyList(CurrentTexts(mockTextRep),
                       testObj.InterestingTexts, "texts from initial list of two");
            VerifyTextsChangedArgs(1, 0, 1);
            Assert.IsTrue(testObj.IsInterestingText(mockTextRep.m_texts[1].ContentsOA), "text not removed still interesting");
            Assert.IsFalse(testObj.IsInterestingText(removed), "removed text no longer interesting");
        }