Beispiel #1
0
        public void ParseArgumentsSetsIndex()
        {
            LegendCommand cmd = new LegendCommand();

            cmd.ArgumentsString = @"""column 1"", ""[value] = 'Q1'"", ""Rectangle 5""";
            var   slide  = new Slide();
            Shape shape1 = new Shape(@"<p:sp xmlns:p=""http://schemas.openxmlformats.org/presentationml/2006/main""><p:nvSpPr><p:cNvPr id=""20"" name=""Rectangle 4"" /><p:cNvSpPr><a:spLocks noChangeArrowheads=""1"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main"" /></p:cNvSpPr><p:nvPr><p:custDataLst><p:tags r:id=""rId3"" xmlns:r=""http://schemas.openxmlformats.org/officeDocument/2006/relationships"" /></p:custDataLst></p:nvPr></p:nvSpPr><p:spPr bwMode=""gray""><a:xfrm xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:off x=""365919"" y=""1103735"" /><a:ext cx=""8229527"" cy=""4924001"" /></a:xfrm><a:prstGeom prst=""rect"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:avLst /></a:prstGeom><a:solidFill xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""bg1""><a:lumMod val=""95000"" /></a:schemeClr></a:solidFill><a:ln w=""25400"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:noFill /></a:ln><a:effectLst xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:outerShdw blurRad=""50800"" dist=""38100"" dir=""2700000"" algn=""tl"" rotWithShape=""0""><a:prstClr val=""black""><a:alpha val=""40000"" /></a:prstClr></a:outerShdw></a:effectLst></p:spPr><p:style><a:lnRef idx=""2"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""accent1""><a:shade val=""50000"" /></a:schemeClr></a:lnRef><a:fillRef idx=""1"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""accent1"" /></a:fillRef><a:effectRef idx=""0"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""accent1"" /></a:effectRef><a:fontRef idx=""minor"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""lt1"" /></a:fontRef></p:style><p:txBody><a:bodyPr rtlCol=""0"" anchor=""ctr"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main"" /><a:lstStyle xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main"" /><a:p xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:endParaRPr lang=""en-US"" sz=""1100"" b=""1"" dirty=""0""><a:solidFill><a:schemeClr val=""lt1"" /></a:solidFill><a:latin typeface=""+mn-lt"" /></a:endParaRPr></a:p></p:txBody></p:sp>");
            Shape shape2 = new Shape(@"<p:sp xmlns:p=""http://schemas.openxmlformats.org/presentationml/2006/main""><p:nvSpPr><p:cNvPr id=""21"" name=""Rectangle 5"" /><p:cNvSpPr><a:spLocks noChangeArrowheads=""1"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main"" /></p:cNvSpPr><p:nvPr><p:custDataLst><p:tags r:id=""rId4"" xmlns:r=""http://schemas.openxmlformats.org/officeDocument/2006/relationships"" /></p:custDataLst></p:nvPr></p:nvSpPr><p:spPr bwMode=""gray""><a:xfrm xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:off x=""365919"" y=""1103735"" /><a:ext cx=""8229527"" cy=""4924001"" /></a:xfrm><a:prstGeom prst=""rect"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:avLst /></a:prstGeom><a:solidFill xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""bg1""><a:lumMod val=""95000"" /></a:schemeClr></a:solidFill><a:ln w=""25400"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:noFill /></a:ln><a:effectLst xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:outerShdw blurRad=""50800"" dist=""38100"" dir=""2700000"" algn=""tl"" rotWithShape=""0""><a:prstClr val=""black""><a:alpha val=""40000"" /></a:prstClr></a:outerShdw></a:effectLst></p:spPr><p:style><a:lnRef idx=""2"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""accent1""><a:shade val=""50000"" /></a:schemeClr></a:lnRef><a:fillRef idx=""1"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""accent1"" /></a:fillRef><a:effectRef idx=""0"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""accent1"" /></a:effectRef><a:fontRef idx=""minor"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:schemeClr val=""lt1"" /></a:fontRef></p:style><p:txBody><a:bodyPr rtlCol=""0"" anchor=""ctr"" xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main"" /><a:lstStyle xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main"" /><a:p xmlns:a=""http://schemas.openxmlformats.org/drawingml/2006/main""><a:endParaRPr lang=""en-US"" sz=""1100"" b=""1"" dirty=""0""><a:solidFill><a:schemeClr val=""lt1"" /></a:solidFill><a:latin typeface=""+mn-lt"" /></a:endParaRPr></a:p></p:txBody></p:sp>");

            slide.AppendChild <DocumentFormat.OpenXml.Presentation.Shape>(shape1);
            slide.AppendChild <DocumentFormat.OpenXml.Presentation.Shape>(shape2);
            Document doc          = new Document();
            var      slideElement = new SlideElement(doc)
            {
                Slide = slide
            };
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            element.Slide     = slideElement;
            cmd.TargetElement = element;

            cmd.ParseArguments();

            Assert.AreEqual("column 1", cmd.Index.Name);
            Assert.AreEqual("[value] = 'Q1'", cmd.Formula);
            Assert.AreEqual("Rectangle 5", cmd.LegendObjectName);
            Assert.AreSame(shape2, cmd.LegendObject.Element);
        }
Beispiel #2
0
        public void ParseRecognisesAdditionalDataElements()
        {
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create(@"TEST_1[""column 1"", 4, 6][2, 4, ""row 1""] TEST_A[""column A1""][""row A2""] TEST_B[""column B1""][""row B2""] NO_CONTENT FORMAT{""##,#"", ""de-DE""} FIXED LEGEND_FROM{1} SORT{2, ASC} FORMULA{""[column 2] - [column 1]""}", slide));

            Assert.AreEqual(@"TEST_1[""column 1"", 4, 6][2, 4, ""row 1""] TEST_A[""column A1""][""row A2""] TEST_B[""column B1""][""row B2""] NO_CONTENT FORMAT{""##,#"", ""de-DE""} FIXED LEGEND_FROM{1} SORT{2, ASC} FORMULA{""[column 2] - [column 1]""}", element.FullName);
            Assert.AreEqual("TEST_1", element.Name);
            Assert.AreEqual(@"""column 1"", 4, 6", element.DataDescriptor.ColumnIndexesString);
            Assert.AreEqual(@"2, 4, ""row 1""", element.DataDescriptor.RowIndexesString);
            Assert.AreEqual(2, element.AdditionalDataDescriptors.Count);
            Assert.AreEqual(@"""column A1""", element.AdditionalDataDescriptors[0].ColumnIndexesString);
            Assert.AreEqual(@"""row A2""", element.AdditionalDataDescriptors[0].RowIndexesString);
            Assert.AreEqual("TEST_A", element.AdditionalDataDescriptors[0].Name);
            Assert.AreEqual(@"""column B1""", element.AdditionalDataDescriptors[1].ColumnIndexesString);
            Assert.AreEqual(@"""row B2""", element.AdditionalDataDescriptors[1].RowIndexesString);
            Assert.AreEqual("TEST_B", element.AdditionalDataDescriptors[1].Name);
            Assert.AreEqual(@"NO_CONTENT FORMAT{""##,#"", ""de-DE""} FIXED LEGEND_FROM{1} SORT{2, ASC} FORMULA{""[column 2] - [column 1]""}", element.CommandString);
            Assert.AreEqual("column 1", element.ColumnIndexes[0].Name);
            Assert.AreEqual(4, element.ColumnIndexes[1].Number.Value);
            Assert.AreEqual(6, element.ColumnIndexes[2].Number.Value);
            Assert.AreEqual(@"column A1", element.ColumnIndexes[3].Name);
            Assert.AreEqual(@"column B1", element.ColumnIndexes[4].Name);
            Assert.AreEqual(2, element.RowIndexes[0].Number.Value);
            Assert.AreEqual(4, element.RowIndexes[1].Number.Value);
            Assert.AreEqual("row 1", element.RowIndexes[2].Name);
            Assert.AreEqual("row A2", element.RowIndexes[3].Name);
            Assert.AreEqual("row B2", element.RowIndexes[4].Name);
        }
Beispiel #3
0
        public void CheckCommandsForIndexesAddsIndexesToTheListButUsesRowsIfTransposed()
        {
            var sc = new FormulaCommand();

            sc.UsedIndexes.Add(new Index("Totals"));
            var tc = new TransposeCommand();
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create("TEST"));

            element.ColumnIndexes.Add(new Index("#Cl1N#"));
            element.ColumnIndexes.Add(new Index("#Cl2N#"));
            element.RowIndexes.Add(new Index("AD"));
            element.RowIndexes.Add(new Index("AM"));
            element.Commands.Add(tc);
            element.Commands.Add(sc);
            element.CheckCommandsForIndexes();
            Assert.AreEqual(2, element.ColumnIndexes.Count);
            Assert.AreEqual(3, element.RowIndexes.Count);
            Assert.AreEqual("#Cl1N#", element.ColumnIndexes[0].Name);
            Assert.AreEqual("#Cl2N#", element.ColumnIndexes[1].Name);
            Assert.AreEqual("AD", element.RowIndexes[0].Name);
            Assert.AreEqual("AM", element.RowIndexes[1].Name);
            Assert.AreEqual("Totals", element.RowIndexes[2].Name);
            Assert.IsFalse(element.ColumnIndexes[0].IsHidden);
            Assert.IsFalse(element.ColumnIndexes[1].IsHidden);
            Assert.IsFalse(element.RowIndexes[0].IsHidden);
            Assert.IsFalse(element.RowIndexes[1].IsHidden);
            Assert.IsTrue(element.RowIndexes[2].IsHidden);
        }
Beispiel #4
0
        public void ParseBehavesWellWhenThereAreNoCommandsOrIndexes()
        {
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create(@"TEST_1", slide));

            Assert.AreEqual(@"TEST_1", element.FullName);
            Assert.AreEqual("TEST_1", element.Name);
            Assert.AreEqual("", element.DataDescriptor.ColumnIndexesString);
            Assert.AreEqual("", element.DataDescriptor.RowIndexesString);
            Assert.AreEqual("", element.CommandString);
        }
Beispiel #5
0
        public void ParseArgumentsSetsFormula()
        {
            VisibleCommand cmd = new VisibleCommand();

            cmd.ArgumentsString = @"""[value] > 5 OR [value] <- 5""";
            Document         doc     = new Document();
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual("[value] > 5 OR [value] <- 5", cmd.Formula);
        }
Beispiel #6
0
        public void PreprocessSwitchCommandsBaseSetsRowAndColumnHeadersToTrueWhenNoCommandsAreOnTheList()
        {
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());
            var commands             = new List <Command>()
            {
                new FormatCommand(), new FormulaCommand(), new FixedCommand()
            };
            var result = element.PreprocessSwitchCommandsBase(commands);

            Assert.AreEqual(3, result.Count());
            Assert.IsFalse(element.UseRowHeaders);
            Assert.IsFalse(element.UseColumnHeaders);
        }
Beispiel #7
0
        public void ParseArgumentsSetsRowsToSkip()
        {
            SkipCommand cmd = new SkipCommand();

            cmd.ArgumentsString = @"15";
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual(15, cmd.RowsToSkip);
        }
Beispiel #8
0
        public void ParseArgumentsSetsIndexAndDescendingWhenDescendingProvided()
        {
            SortCommand cmd = new SortCommand();

            cmd.ArgumentsString = @"""col 3"" DESC";
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual("col 3", cmd.Index.Name);
            Assert.AreEqual(SortOrder.Descending, cmd.SortOrder);
        }
Beispiel #9
0
        public void ParseArgumentsSetsMaximumRowsAndColumnsPerPageWhenEmptyArguments()
        {
            PageCommand cmd = new PageCommand();

            cmd.ArgumentsString = @"";
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual(Int32.MaxValue, cmd.RowsPerPage);
            Assert.AreEqual(Int32.MaxValue, cmd.ColumnsPerPage);
        }
Beispiel #10
0
        public void ParseArgumentsSetsFormatAndCultureWithCulture()
        {
            FormatCommand cmd = new FormatCommand();

            cmd.ArgumentsString = @"""##,#"", ""de-DE""";
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual("##,#", cmd.FormatString);
            Assert.AreEqual((new CultureInfo("de-DE")).Name, cmd.Culture.Name);
        }
Beispiel #11
0
        public void ParseArgumentsSetsRowsAndColumnsPerPageWhenBothSpecified()
        {
            PageCommand cmd = new PageCommand();

            cmd.ArgumentsString = @"15, 5";
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual(15, cmd.RowsPerPage);
            Assert.AreEqual(5, cmd.ColumnsPerPage);
        }
Beispiel #12
0
        public void ParseArgumentsSetsFormatAndDefaultCultureWithInvalidCulture()
        {
            FormatCommand cmd = new FormatCommand();

            cmd.ArgumentsString = @"""##,#"", ""aa-aa""";
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual("##,#", cmd.FormatString);
            Assert.AreEqual(CultureInfo.CurrentUICulture.Name, cmd.Culture.Name);
        }
Beispiel #13
0
        public void ParseArgumentsSetsUsedIndexes()
        {
            VisibleCommand cmd = new VisibleCommand();

            cmd.ArgumentsString = @"""[column 1] > 5 OR [3] <- 5""";
            Document         doc     = new Document();
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual(2, cmd.UsedIndexes.Count);
            Assert.AreEqual("column 1", cmd.UsedIndexes[0].Name);
            Assert.AreEqual(3, cmd.UsedIndexes[1].Number.Value);
        }
Beispiel #14
0
        public void ParseArgumentsSetsFormulaWithStringValues()
        {
            FormulaCommand cmd = new FormulaCommand();

            cmd.ArgumentsString = @"""[column 2] = 'test'""";
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual("[column 2] = 'test'", cmd.Formula);
            Assert.AreEqual("column 2", cmd.UsedIndexes[0].Name);
            Assert.AreEqual(1, cmd.UsedIndexes.Count);
            Assert.IsFalse(cmd.IsInPlaceFormula);
        }
Beispiel #15
0
        public void FindShapeDataSetsDataCloneWhenMatchingElementFoundAndReturnsTrue()
        {
            DataElement de1 = new DataElement {
                Name = "test 2"
            };
            DataElement de2 = new DataElement {
                Name = "Test"
            };
            IList <DataElement> data = new List <DataElement> {
                de1, de2
            };
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create("TEST"));

            element.FindShapeData(data);
            Assert.AreNotSame(de2, element.Data);
        }
Beispiel #16
0
        public void ParseArgumentsSetsReplacements()
        {
            ReplaceCommand cmd = new ReplaceCommand();

            cmd.ArgumentsString = @"""true"" = ""ü"", ""false""="""", ""1""=""one"", ""client""=""IBM""";
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            cmd.TargetElement = element;
            cmd.ParseArguments();
            Assert.AreEqual(4, cmd.Substitutions.Count);
            Assert.AreEqual("ü", cmd.Substitutions["true"]);
            Assert.AreEqual("", cmd.Substitutions["false"]);
            Assert.AreEqual("one", cmd.Substitutions["1"]);
            Assert.AreEqual("IBM", cmd.Substitutions["client"]);
        }
Beispiel #17
0
        public void ParseExtractsIndexesWithRanges()
        {
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create(@"TEST_1[2, ""column 1"", 4-6][2-4, 8, ""row 1""]", slide));

            Assert.AreEqual(2, element.ColumnIndexes[0].Number.Value);
            Assert.AreEqual("column 1", element.ColumnIndexes[1].Name);
            Assert.AreEqual(4, element.ColumnIndexes[2].Number.Value);
            Assert.AreEqual(5, element.ColumnIndexes[3].Number.Value);
            Assert.AreEqual(6, element.ColumnIndexes[4].Number.Value);

            Assert.AreEqual(2, element.RowIndexes[0].Number.Value);
            Assert.AreEqual(3, element.RowIndexes[1].Number.Value);
            Assert.AreEqual(4, element.RowIndexes[2].Number.Value);
            Assert.AreEqual(8, element.RowIndexes[3].Number.Value);
            Assert.AreEqual("row 1", element.RowIndexes[4].Name);
        }
Beispiel #18
0
        public void ParseSeparatesPartsOfTheNameStringAndExtractsIndexes()
        {
            Document         doc     = new Document();
            var              slide   = new SlideElement(doc);
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create(@"TEST_1[""column 1"", 4, 6][2, 4, ""row 1""] FORMAT{""##,#"", ""de-DE""} FIXED LEGEND_FROM{1} SORT{2, ASC} FORMULA{""[column 2] - [column 1]""}", slide));

            Assert.AreEqual(@"TEST_1[""column 1"", 4, 6][2, 4, ""row 1""] FORMAT{""##,#"", ""de-DE""} FIXED LEGEND_FROM{1} SORT{2, ASC} FORMULA{""[column 2] - [column 1]""}", element.FullName);
            Assert.AreEqual("TEST_1", element.Name);
            Assert.AreEqual(@"""column 1"", 4, 6", element.DataDescriptor.ColumnIndexesString);
            Assert.AreEqual(@"2, 4, ""row 1""", element.DataDescriptor.RowIndexesString);
            Assert.AreEqual(@"FORMAT{""##,#"", ""de-DE""} FIXED LEGEND_FROM{1} SORT{2, ASC} FORMULA{""[column 2] - [column 1]""}", element.CommandString);
            Assert.AreEqual("column 1", element.ColumnIndexes[0].Name);
            Assert.AreEqual(4, element.ColumnIndexes[1].Number.Value);
            Assert.AreEqual(6, element.ColumnIndexes[2].Number.Value);
            Assert.AreEqual(2, element.RowIndexes[0].Number.Value);
            Assert.AreEqual(4, element.RowIndexes[1].Number.Value);
            Assert.AreEqual("row 1", element.RowIndexes[2].Name);
        }
Beispiel #19
0
        public void ApplyToDataFormatsAllValues()
        {
            DataElement      da      = Helpers.CreateTestDataElement();
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create());

            element.RowIndexes.Clear();
            element.RowIndexes.Add(new Index(0));
            element.RowIndexes.Add(new Index(1));
            element.ColumnIndexes.Clear();
            element.ColumnIndexes.Add(new Index(0));
            FormatCommand cmd = new FormatCommand();

            cmd.TargetElement = element;
            cmd.FormatString  = "0.0000";
            cmd.ApplyToData(da);
            Assert.AreEqual("1.0000", da.Row(0).Data[0]);
            Assert.AreEqual("5.0500", da.Row(1).Data[0]);
            Assert.AreEqual("1.0000", da.Column(0).Data[0]);
            Assert.AreEqual("5.0500", da.Column(0).Data[1]);
        }
Beispiel #20
0
        public void FindShapeSetsDataToNullWhenMatchingElementNotFound()
        {
            DataElement de1 = new DataElement {
                Name = "test 2"
            };
            DataElement de2 = new DataElement {
                Name = "Test 1"
            };
            IList <DataElement> data = new List <DataElement> {
                de1, de2
            };
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create("TEST"));

            element.Slide = new SlideElement(new Document())
            {
                Number = 1
            };

            element.FindShapeData(data);
            Assert.IsNull(element.Data);
        }
Beispiel #21
0
        public void CheckCommandsForIndexesAddsIndexesToTheList()
        {
            var cmd1 = new FormulaCommand();

            cmd1.UsedIndexes.Add(new Index("#Cl1N#"));
            cmd1.UsedIndexes.Add(new Index("#Cl2N#"));
            var cmd2 = new FormulaCommand();

            cmd2.UsedIndexes.Add(new Index("#P1N#"));
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create("TEST"));

            element.Commands.Add(cmd1);
            element.Commands.Add(cmd2);
            element.CheckCommandsForIndexes();
            Assert.AreEqual("#Cl1N#", element.ColumnIndexes[0].Name);
            Assert.AreEqual("#Cl2N#", element.ColumnIndexes[1].Name);
            Assert.AreEqual("#P1N#", element.ColumnIndexes[2].Name);
            Assert.IsTrue(element.ColumnIndexes[0].IsHidden);
            Assert.IsTrue(element.ColumnIndexes[1].IsHidden);
            Assert.IsTrue(element.ColumnIndexes[2].IsHidden);
        }
Beispiel #22
0
        public void FindShapeCallsMergeWithOnAdditionalDataElements()
        {
            var de1 = new Mock <DataElement>();
            var de2 = new Mock <DataElement>();

            de1.SetupGet(e => e.Name).Returns("TEST");
            de1.Setup(e => e.Clone()).Returns(de1.Object);
            de2.SetupGet(e => e.Name).Returns("TEST_B");
            de2.Setup(e => e.Clone()).Returns(de2.Object);
            IList <DataElement> data = new List <DataElement> {
                de1.Object, de2.Object
            };
            ShapeElementBase element = (ShapeElementBase)(ShapeElementBaseTest.Create("TEST"));

            element.AdditionalDataDescriptors.Add(new DataElementDescriptor {
                Name = "TEST_B"
            });
            element.FindShapeData(data);

            de1.Verify(e => e.MergeWith(It.IsAny <DataElement>()), Times.Once());
            de2.Verify(e => e.MergeWith(It.IsAny <DataElement>()), Times.Never());
        }