예제 #1
0
        public void FormatSelectedCode_AllSelected()
        {
            string htmlCode = Resource1.HTMLContent2;

            string[]           pos   = null;
            HighLightParameter param = new HighLightParameter();

            param.ShowLineNumber = true;
            param.HighlightColor = System.Drawing.Color.FromArgb(240, 240, 240);


            AddIn addIn = new AddIn();

            addIn.ns = @"http://schemas.microsoft.com/office/onenote/2013/onenote";

            var outline = XDocument.Parse(Resource1.Page2).Descendants(addIn.ns + "Outline")
                          .Where(n => n.Attribute("selected") != null && (n.Attribute("selected").Value == "all" || n.Attribute("selected").Value == "partial"))
                          .FirstOrDefault();

            //Arrange
            ExeConfigurationFileMap fileMap = new ExeConfigurationFileMap {
                ExeConfigFilename = "Test.config"
            };
            Configuration configuration = ConfigurationManager.OpenMappedExeConfiguration(fileMap, ConfigurationUserLevel.None);

            HighLightSection config = configuration.GetSection("HighLightSection") as HighLightSection;

            bool selectedTextFormated = false;

            addIn.GetSelectedText(Resource1.Page2, out selectedTextFormated);


            XDocument output = addIn.InsertHighLightCode(htmlCode, pos, param, outline, config, selectedTextFormated, addIn.IsSelectedTextInline(Resource1.Page2));

            Assert.AreEqual(Resource1.Output2, output.ToString(), false);
        }