public void LoadTest()
        {
            ISongFileReader <ExtendedPowerPraiseSong> reader = new ExtendedPowerPraiseSongFileReader();
            const string filename = "Resources/powerpraise/Näher, mein Gott zu Dir.ppl";

            PowerPraiseSong expected = PowerPraiseTestUtil.GetExpectedPowerPraiseSong();

            ExtendedPowerPraiseSong actual = reader.Load(filename);

            // General
            Assert.AreEqual(expected.Title, actual.Title, "Wrong song title");
            Assert.AreEqual(expected.Language, actual.Language, "Wrong language");
            Assert.AreEqual(expected.Category, actual.Category, "Wrong category");

            // Parts
            Assert.AreEqual(expected.Parts.Count, actual.Parts.Count, "Parts incomplete");
            for (int i = 0; i < expected.Parts.Count; i++)
            {
                Assert.AreEqual(expected.Parts[i].Caption, actual.Parts[i].Caption, "Wrong verse name in verse " + i);
                Assert.AreEqual(expected.Parts[i].Slides.Count, actual.Parts[i].Slides.Count, "Slides incomplete in verse " + i);
                for (int j = 0; j < expected.Parts[i].Slides.Count; j++)
                {
                    Assert.AreEqual(expected.Parts[i].Slides[j].Background, actual.Parts[i].Slides[j].Background);
                    Assert.AreEqual(expected.Parts[i].Slides[j].MainSize, actual.Parts[i].Slides[j].MainSize);
                    CollectionAssert.AreEqual(expected.Parts[i].Slides[j].Lines, actual.Parts[i].Slides[j].Lines, "Slide lines incomplete in verse " + i + " slide " + j);
                    CollectionAssert.AreEqual(expected.Parts[i].Slides[j].Translation, actual.Parts[i].Slides[j].Translation, "Slide translation incomplete in verse " + i + " slide " + j);
                }
            }

            // Order
            Assert.AreEqual(expected.Order.Count, actual.Order.Count, "Order incomplete");
            for (int i = 0; i < expected.Order.Count; i++)
            {
                Assert.AreEqual(expected.Order[i].Caption, actual.Order[i].Caption, "Wrong verse name in verse " + i);
            }

            // Copyright
            CollectionAssert.AreEqual(expected.CopyrightText, actual.CopyrightText, "Wrong copyright");
            Assert.AreEqual(expected.Formatting.CopyrightTextPosition, actual.Formatting.CopyrightTextPosition, "Wrong copyright text position");

            // Source
            Assert.AreEqual(expected.SourceText, actual.SourceText, "Wrong source text");
            Assert.AreEqual(expected.Formatting.SourceTextPosition, actual.Formatting.SourceTextPosition, "Wrong source text position");

            // Formatting
            Assert.AreEqual(expected.Formatting.MainText.Font, actual.Formatting.MainText.Font);
            Assert.AreEqual(expected.Formatting.MainText.Color.ToArgb(), actual.Formatting.MainText.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.MainText.OutlineWidth, actual.Formatting.MainText.OutlineWidth);
            Assert.AreEqual(expected.Formatting.MainText.ShadowDistance, actual.Formatting.MainText.ShadowDistance);

            Assert.AreEqual(expected.Formatting.TranslationText.Font, actual.Formatting.TranslationText.Font);
            Assert.AreEqual(expected.Formatting.TranslationText.Color.ToArgb(), actual.Formatting.TranslationText.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.TranslationText.OutlineWidth, actual.Formatting.TranslationText.OutlineWidth);
            Assert.AreEqual(expected.Formatting.TranslationText.ShadowDistance, actual.Formatting.TranslationText.ShadowDistance);

            Assert.AreEqual(expected.Formatting.CopyrightText.Font, actual.Formatting.CopyrightText.Font);
            Assert.AreEqual(expected.Formatting.CopyrightText.Color.ToArgb(), actual.Formatting.CopyrightText.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.CopyrightText.OutlineWidth, actual.Formatting.CopyrightText.OutlineWidth);
            Assert.AreEqual(expected.Formatting.CopyrightText.ShadowDistance, actual.Formatting.CopyrightText.ShadowDistance);

            Assert.AreEqual(expected.Formatting.SourceText.Font, actual.Formatting.SourceText.Font);
            Assert.AreEqual(expected.Formatting.SourceText.Color.ToArgb(), actual.Formatting.SourceText.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.SourceText.OutlineWidth, actual.Formatting.SourceText.OutlineWidth);
            Assert.AreEqual(expected.Formatting.SourceText.ShadowDistance, actual.Formatting.SourceText.ShadowDistance);

            Assert.AreEqual(expected.Formatting.Outline.Color.ToArgb(), actual.Formatting.Outline.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.Outline.Enabled, actual.Formatting.Outline.Enabled);

            Assert.AreEqual(expected.Formatting.Shadow.Color.ToArgb(), actual.Formatting.Shadow.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.Shadow.Direction, actual.Formatting.Shadow.Direction);
            Assert.AreEqual(expected.Formatting.Shadow.Enabled, actual.Formatting.Shadow.Enabled);

            // Linespacing
            Assert.AreEqual(expected.Formatting.MainLineSpacing, actual.Formatting.MainLineSpacing);
            Assert.AreEqual(expected.Formatting.TranslationLineSpacing, actual.Formatting.TranslationLineSpacing);

            // Text orientation
            Assert.AreEqual(expected.Formatting.TextOrientation, actual.Formatting.TextOrientation);
            Assert.AreEqual(expected.Formatting.TranslationPosition, actual.Formatting.TranslationPosition);

            // Borders
            Assert.AreEqual(expected.Formatting.Borders.TextLeft, actual.Formatting.Borders.TextLeft);
            Assert.AreEqual(expected.Formatting.Borders.TextTop, actual.Formatting.Borders.TextTop);
            Assert.AreEqual(expected.Formatting.Borders.TextRight, actual.Formatting.Borders.TextRight);
            Assert.AreEqual(expected.Formatting.Borders.TextBottom, actual.Formatting.Borders.TextBottom);
            Assert.AreEqual(expected.Formatting.Borders.CopyrightBottom, actual.Formatting.Borders.CopyrightBottom);
            Assert.AreEqual(expected.Formatting.Borders.SourceTop, actual.Formatting.Borders.SourceTop);
            Assert.AreEqual(expected.Formatting.Borders.SourceRight, actual.Formatting.Borders.SourceRight);
        }
Exemplo n.º 2
0
        public void ReadAndMapTest()
        {
            const string filename = "Resources/powerpraise/Näher, mein Gott zu Dir - extended.ppl";

            ISongFileReader <ExtendedPowerPraiseSong> reader = new ExtendedPowerPraiseSongFileReader();
            ExtendedPowerPraiseSongFileMapper         mapper = new ExtendedPowerPraiseSongFileMapper();

            Song expected = ExtendedPowerPraiseTestUtil.GetExpectedSongExtended();

            ExtendedPowerPraiseSong source = reader.Load(filename);
            Song actual = mapper.Map(source);

            Assert.AreEqual(expected.Guid, actual.Guid, "Wrong GUID");
            Assert.AreEqual(expected.ModifiedTimestamp, actual.ModifiedTimestamp, "Wrong modified timestamp");
            Assert.AreEqual(expected.CreatedIn, actual.CreatedIn, "Wrong created in");
            Assert.AreEqual(expected.ModifiedIn, actual.ModifiedIn, "Wrong modified in");
            Assert.AreEqual(expected.Title, actual.Title, "Wrong song title");
            Assert.AreEqual(expected.Language, actual.Language, "Wrong language");
            Assert.AreEqual(expected.CcliIdentifier, actual.CcliIdentifier, "Wrong CcliID");
            Assert.AreEqual(expected.Copyright, actual.Copyright, "Wrong copyright");
            Assert.AreEqual(expected.Formatting.CopyrightPosition, actual.Formatting.CopyrightPosition, "Wrong copyright position");
            Assert.AreEqual(expected.Formatting.SourcePosition, actual.Formatting.SourcePosition, "Wrong source position");
            Assert.AreEqual(expected.ReleaseYear, actual.ReleaseYear, "Wrong release year");
            CollectionAssert.AreEqual(expected.Authors, actual.Authors, "Wrong author");
            Assert.AreEqual(expected.RightsManagement, actual.RightsManagement, "Wrong rights Management");
            Assert.AreEqual(expected.Publisher, actual.Publisher, "Wrong publisher");
            Assert.AreEqual(expected.Version, actual.Version, "Wrong version");
            Assert.AreEqual(expected.Key, actual.Key, "Wrong key");
            Assert.AreEqual(expected.Transposition, actual.Transposition, "Wrong transposition");
            Assert.AreEqual(expected.Tempo, actual.Tempo, "Wrong tempo");
            Assert.AreEqual(expected.Variant, actual.Variant, "Wrong variant");
            Assert.AreEqual(expected.Themes[0], actual.Themes[0], "Wrong theme");
            Assert.AreEqual(expected.Comment, actual.Comment, "Wrong comment");
            Assert.AreEqual(expected.SongBooks[0].Name, actual.SongBooks[0].Name, "Wrong songbook");

            Assert.AreEqual(expected.Parts.Count, actual.Parts.Count, "Parts incomplete");
            for (int i = 0; i < expected.Parts.Count; i++)
            {
                Assert.AreEqual(expected.Parts[i].Caption, actual.Parts[i].Caption, "Wrong verse name in verse " + i);
                Assert.AreEqual(expected.Parts[i].Slides.Count, actual.Parts[i].Slides.Count, "Slides incomplete in verse " + i);
                for (int j = 0; j < expected.Parts[i].Slides.Count; j++)
                {
                    Assert.AreEqual(expected.Parts[i].Slides[j].Background, actual.Parts[i].Slides[j].Background, "Wrong image paths");
                    CollectionAssert.AreEqual(expected.Parts[i].Slides[j].Lines, actual.Parts[i].Slides[j].Lines, "Slide lines incomplete in verse " + i + " slide " + j);
                    CollectionAssert.AreEqual(expected.Parts[i].Slides[j].Translation, actual.Parts[i].Slides[j].Translation, "Slide translation lines incomplete in verse " + i + " slide " + j);
                }
            }
            CollectionAssert.AreEqual(expected.PartSequence, actual.PartSequence, "Wrong part sequence");

            Assert.AreEqual(expected.QualityIssues, actual.QualityIssues, "Wrong QA issues");

            Assert.AreEqual(expected.Formatting.MainText.Font, actual.Formatting.MainText.Font);
            Assert.AreEqual(expected.Formatting.MainText.Color.ToArgb(), actual.Formatting.MainText.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.MainText.Outline.Color.ToArgb(), actual.Formatting.MainText.Outline.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.MainText.Outline.Width, actual.Formatting.MainText.Outline.Width);
            Assert.AreEqual(expected.Formatting.MainText.Shadow.Color.ToArgb(), actual.Formatting.MainText.Shadow.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.MainText.Shadow.Direction, actual.Formatting.MainText.Shadow.Direction);
            Assert.AreEqual(expected.Formatting.MainText.Shadow.Distance, actual.Formatting.MainText.Shadow.Distance);
            Assert.AreEqual(expected.Formatting.MainLineSpacing, actual.Formatting.MainLineSpacing);

            Assert.AreEqual(expected.Formatting.TranslationText.Font, actual.Formatting.TranslationText.Font);
            Assert.AreEqual(expected.Formatting.TranslationText.Color.ToArgb(), actual.Formatting.TranslationText.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.TranslationText.Outline.Color.ToArgb(), actual.Formatting.TranslationText.Outline.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.TranslationText.Outline.Width, actual.Formatting.TranslationText.Outline.Width);
            Assert.AreEqual(expected.Formatting.TranslationText.Shadow.Color.ToArgb(), actual.Formatting.TranslationText.Shadow.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.TranslationText.Shadow.Direction, actual.Formatting.TranslationText.Shadow.Direction);
            Assert.AreEqual(expected.Formatting.TranslationText.Shadow.Distance, actual.Formatting.TranslationText.Shadow.Distance);
            Assert.AreEqual(expected.Formatting.TranslationLineSpacing, actual.Formatting.TranslationLineSpacing);

            Assert.AreEqual(expected.Formatting.CopyrightText.Font, actual.Formatting.CopyrightText.Font);
            Assert.AreEqual(expected.Formatting.CopyrightText.Color.ToArgb(), actual.Formatting.CopyrightText.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.CopyrightText.Outline.Color.ToArgb(), actual.Formatting.CopyrightText.Outline.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.CopyrightText.Outline.Width, actual.Formatting.CopyrightText.Outline.Width);
            Assert.AreEqual(expected.Formatting.CopyrightText.Shadow.Color.ToArgb(), actual.Formatting.CopyrightText.Shadow.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.CopyrightText.Shadow.Direction, actual.Formatting.CopyrightText.Shadow.Direction);
            Assert.AreEqual(expected.Formatting.CopyrightText.Shadow.Distance, actual.Formatting.CopyrightText.Shadow.Distance);

            Assert.AreEqual(expected.Formatting.SourceText.Font, actual.Formatting.SourceText.Font);
            Assert.AreEqual(expected.Formatting.SourceText.Color.ToArgb(), actual.Formatting.SourceText.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.SourceText.Outline.Color.ToArgb(), actual.Formatting.SourceText.Outline.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.SourceText.Outline.Width, actual.Formatting.SourceText.Outline.Width);
            Assert.AreEqual(expected.Formatting.SourceText.Shadow.Color.ToArgb(), actual.Formatting.SourceText.Shadow.Color.ToArgb());
            Assert.AreEqual(expected.Formatting.SourceText.Shadow.Direction, actual.Formatting.SourceText.Shadow.Direction);
            Assert.AreEqual(expected.Formatting.SourceText.Shadow.Distance, actual.Formatting.SourceText.Shadow.Distance);

            Assert.AreEqual(expected.Formatting.TextOrientation, actual.Formatting.TextOrientation);
            Assert.AreEqual(expected.Formatting.TextOutlineEnabled, actual.Formatting.TextOutlineEnabled);
            Assert.AreEqual(expected.Formatting.TextShadowEnabled, actual.Formatting.TextShadowEnabled);

            Assert.AreEqual(expected.Formatting.TextBorders.TextLeft, actual.Formatting.TextBorders.TextLeft);
            Assert.AreEqual(expected.Formatting.TextBorders.TextTop, actual.Formatting.TextBorders.TextTop);
            Assert.AreEqual(expected.Formatting.TextBorders.TextRight, actual.Formatting.TextBorders.TextRight);
            Assert.AreEqual(expected.Formatting.TextBorders.TextBottom, actual.Formatting.TextBorders.TextBottom);
            Assert.AreEqual(expected.Formatting.TextBorders.CopyrightBottom, actual.Formatting.TextBorders.CopyrightBottom);
            Assert.AreEqual(expected.Formatting.TextBorders.SourceRight, actual.Formatting.TextBorders.SourceRight);
            Assert.AreEqual(expected.Formatting.TextBorders.SourceTop, actual.Formatting.TextBorders.SourceTop);

            Assert.IsTrue(SongSearchUtil.GetSearchableSongText(actual).Contains("näher mein gott zu dir"));
            Assert.IsTrue(SongSearchUtil.GetSearchableSongText(actual).Contains("geborgen"));
        }
 public ExtendedPowerPraiseSongFilePlugin()
 {
     Reader = new ExtendedPowerPraiseSongFileReader();
     Mapper = new ExtendedPowerPraiseSongFileMapper();
     Writer = new ExtendedPowerPraiseSongFileWriter();
 }