Esempio n. 1
0
        public void CleanUpOrphanedMultiBlockQuoteStati_NoneFollowedByMultipleNonStarts_NonStartsChangedToNone()
        {
            var block1 = CreateTestBlock(1, MultiBlockQuote.None);
            var block2 = CreateTestBlock(2, MultiBlockQuote.Continuation);
            var block3 = CreateTestBlock(3, MultiBlockQuote.Continuation);

            var block1Original = block1.Clone();
            var block2Original = block2.Clone();
            var block3Original = block3.Clone();

            var book = new BookScript("MAT", new List <Block> {
                block1, block2, block3
            });
            var books = new List <BookScript> {
                book
            };

            ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books);

            Assert.AreEqual(3, book.Blocks.Count);
            Assert.AreEqual(block1Original.GetText(true), block1.GetText(true));
            Assert.AreEqual(block2Original.GetText(true), block2.GetText(true));
            Assert.AreEqual(block3Original.GetText(true), block3.GetText(true));
            Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote);
            Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote);
            Assert.AreEqual(MultiBlockQuote.None, block3.MultiBlockQuote);
        }
        public void CleanUpOrphanedMultiBlockQuoteStati_NoneFollowedByNonStart_NonStartChangedToNone(MultiBlockQuote continuingStatus)
        {
            var block1 = CreateTestBlock(1, MultiBlockQuote.None);
            var block2 = CreateTestBlock(2, continuingStatus);

            var block1Original = block1.Clone();
            var block2Original = block2.Clone();

            var book = new BookScript {
                Blocks = new List <Block> {
                    block1, block2
                }
            };
            var books = new List <BookScript> {
                book
            };

            ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books);

            Assert.AreEqual(2, book.Blocks.Count);
            Assert.AreEqual(block1Original.GetText(true), block1.GetText(true));
            Assert.AreEqual(block2Original.GetText(true), block2.GetText(true));
            Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote);
            Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote);
        }
Esempio n. 3
0
        public void CleanUpOrphanedMultiBlockQuoteStati_TwoStarts_FirstStartChangedToNone(MultiBlockQuote continuingStatus)
        {
            var block1 = CreateTestBlock(1, MultiBlockQuote.None);
            var block2 = CreateTestBlock(2, MultiBlockQuote.Start);
            var block3 = CreateTestBlock(3, MultiBlockQuote.Start);
            var block4 = CreateTestBlock(4, continuingStatus);

            var block1Original = block1.Clone();
            var block2Original = block2.Clone();
            var block3Original = block3.Clone();
            var block4Original = block4.Clone();

            var book = new BookScript("MAT", new List <Block> {
                block1, block2, block3, block4
            });
            var books = new List <BookScript> {
                book
            };

            ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books);

            Assert.AreEqual(4, book.Blocks.Count);
            Assert.AreEqual(block1Original.GetText(true), block1.GetText(true));
            Assert.AreEqual(block2Original.GetText(true), block2.GetText(true));
            Assert.AreEqual(block3Original.GetText(true), block3.GetText(true));
            Assert.AreEqual(block4Original.GetText(true), block4.GetText(true));
            Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote);
            Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote);
            Assert.AreEqual(MultiBlockQuote.Start, block3.MultiBlockQuote);
            Assert.AreEqual(continuingStatus, block4.MultiBlockQuote);
        }
        public void CleanUpOrphanedMultiBlockQuoteStati_TwoStartsFollowedByNone_BothStartsChangedToNone()
        {
            var block1 = CreateTestBlock(1, MultiBlockQuote.None);
            var block2 = CreateTestBlock(2, MultiBlockQuote.Start);
            var block3 = CreateTestBlock(3, MultiBlockQuote.Start);
            var block4 = CreateTestBlock(4, MultiBlockQuote.None);

            var block1Original = block1.Clone();
            var block2Original = block2.Clone();
            var block3Original = block3.Clone();
            var block4Original = block4.Clone();

            var book = new BookScript {
                Blocks = new List <Block> {
                    block1, block2, block3, block4
                }
            };
            var books = new List <BookScript> {
                book
            };

            ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books);

            Assert.AreEqual(4, book.Blocks.Count);
            Assert.AreEqual(block1Original.GetText(true), block1.GetText(true));
            Assert.AreEqual(block2Original.GetText(true), block2.GetText(true));
            Assert.AreEqual(block3Original.GetText(true), block3.GetText(true));
            Assert.AreEqual(block4Original.GetText(true), block4.GetText(true));
            Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote);
            Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote);
            Assert.AreEqual(MultiBlockQuote.None, block3.MultiBlockQuote);
            Assert.AreEqual(MultiBlockQuote.None, block4.MultiBlockQuote);
        }
Esempio n. 5
0
        public void CleanUpOrphanedMultiBlockQuoteStati_LastBlockIsStart_StartChangedToNone()
        {
            var block1 = CreateTestBlock(1, MultiBlockQuote.None);
            var block2 = CreateTestBlock(2, MultiBlockQuote.Start);

            var block1Original = block1.Clone();
            var block2Original = block2.Clone();

            var book = new BookScript("MAT", new List <Block> {
                block1, block2
            });
            var books = new List <BookScript> {
                book
            };

            ProjectDataMigrator.CleanUpOrphanedMultiBlockQuoteStati(books);

            Assert.AreEqual(2, book.Blocks.Count);
            Assert.AreEqual(block1Original.GetText(true), block1.GetText(true));
            Assert.AreEqual(block2Original.GetText(true), block2.GetText(true));
            Assert.AreEqual(MultiBlockQuote.None, block1.MultiBlockQuote);
            Assert.AreEqual(MultiBlockQuote.None, block2.MultiBlockQuote);
        }