示例#1
0
        public void MoveTo_EmptyListTest()
        {
            IFdoServiceLocator servLoc  = Cache.ServiceLocator;
            IScrBookFactory    bookFact = servLoc.GetInstance <IScrBookFactory>();

            // Setup the source sequence using the scripture books sequence.
            IScrBook book0 = bookFact.Create(1);
            IScrBook book1 = bookFact.Create(2);
            IScrBook book2 = bookFact.Create(3);

            // Setup the target sequence so it's able to have items moved to it.
            IScrDraft targetSeq = servLoc.GetInstance <IScrDraftFactory>().Create("MoveTo_EmptyListTest");

            m_scr.ScriptureBooksOS.MoveTo(1, 2, targetSeq.BooksOS, 0);

            Assert.AreEqual(2, targetSeq.BooksOS.Count);
            Assert.AreEqual(1, m_scr.ScriptureBooksOS.Count);
            Assert.AreEqual(book1, targetSeq.BooksOS[0]);
            Assert.AreEqual(book2, targetSeq.BooksOS[1]);
        }
示例#2
0
        public void MoveTo_DestListLargerThenSrcTest()
        {
            IFdoServiceLocator servLoc  = Cache.ServiceLocator;
            IScrBookFactory    bookFact = servLoc.GetInstance <IScrBookFactory>();

            // Setup the source sequence using the scripture books sequence.
            IScrBook book0 = bookFact.Create(1);

            // Setup the target sequence so it's able to have items moved to it.
            IScrDraft targetSeq = servLoc.GetInstance <IScrDraftFactory>().Create("MoveTo_DestListLargerThenSrcTest");
            IScrBook  bookD0    = bookFact.Create(targetSeq.BooksOS, 1);
            IScrBook  bookD1    = bookFact.Create(targetSeq.BooksOS, 2);

            m_scr.ScriptureBooksOS.MoveTo(0, 0, targetSeq.BooksOS, 2);

            Assert.AreEqual(3, targetSeq.BooksOS.Count);
            Assert.AreEqual(0, m_scr.ScriptureBooksOS.Count);
            Assert.AreEqual(bookD0, targetSeq.BooksOS[0]);
            Assert.AreEqual(bookD1, targetSeq.BooksOS[1]);
            Assert.AreEqual(book0, targetSeq.BooksOS[2]);
        }
示例#3
0
        public void CopyTo_OneItemInOneItemListTest()
        {
            IFdoServiceLocator servLoc  = Cache.ServiceLocator;
            IScrBookFactory    bookFact = servLoc.GetInstance <IScrBookFactory>();

            // Setup the source sequence using the scripture books sequence.
            IScrBook book0 = bookFact.Create(1);

            IScrBook[] bookArray = new IScrBook[1];
            m_scr.ScriptureBooksOS.CopyTo(bookArray, 0);

            Assert.AreEqual(book0, bookArray[0]);
        }
示例#4
0
        public void Insert_UnownableObject()
        {
            IFdoServiceLocator servLoc  = Cache.ServiceLocator;
            IScrBookFactory    bookFact = servLoc.GetInstance <IScrBookFactory>();

            // Setup the source sequence using the scripture books sequence.
            IStText       text;
            IScrBook      book0       = bookFact.Create(1, out text);
            IStTxtPara    para        = text.AddNewTextPara(ScrStyleNames.MainBookTitle);
            IScrRefSystem systemToAdd = servLoc.GetInstance <IScrRefSystemRepository>().Singleton;

            para.AnalyzedTextObjectsOS.Insert(0, systemToAdd);
        }
示例#5
0
        public void Insert_UnownableObject()
        {
            ILcmServiceLocator servLoc  = Cache.ServiceLocator;
            IScrBookFactory    bookFact = servLoc.GetInstance <IScrBookFactory>();

            // Setup the source sequence using the scripture books sequence.
            IStText text;

            bookFact.Create(1, out text);
            IStTxtPara    para        = text.AddNewTextPara(ScrStyleNames.MainBookTitle);
            IScrRefSystem systemToAdd = servLoc.GetInstance <IScrRefSystemRepository>().Singleton;

            Assert.That(() => para.AnalyzedTextObjectsOS.Insert(0, systemToAdd),
                        Throws.TypeOf <InvalidOperationException>().With.Message.EqualTo("ScrRefSystem can not be owned!"));
        }