public void CheckHomogenousUpdates_ResultTypes()
        {
            var page1  = this.GetNewPage();
            var shape1 = page1.DrawRectangle(0, 0, 1, 1);

            // Setup the modifications to the cell values
            var update = new VA.ShapeSheet.Update();

            update.SetResult(ShapeSheet_Update_Tests.src_linepat, "7", IVisio.VisUnitCodes.visNumber);
            update.SetResult(VA.ShapeSheet.SRCConstants.PinX, 2, IVisio.VisUnitCodes.visNumber);
            update.Execute(shape1);

            // Build the query
            var query       = new VA.ShapeSheet.Query.CellQuery();
            var col_linepat = query.AddCell(ShapeSheet_Update_Tests.src_linepat, "LinePattern");
            var col_pinx    = query.AddCell(VA.ShapeSheet.SRCConstants.PinX, "PinX");

            // Retrieve the values
            var data = query.GetCellData <double>(shape1);

            // Verify
            AssertVA.AreEqual("7", 7, data[col_linepat]);
            AssertVA.AreEqual("2 in", 2, data[col_pinx]);

            page1.Delete(0);
        }
        public void CheckHomogenousUpdates_ResultTypes()
        {
            var page1 = this.GetNewPage();
            var shape1 = page1.DrawRectangle(0, 0, 1, 1);

            // Setup the modifications to the cell values
            var update = new VA.ShapeSheet.Update();
            update.SetResult(ShapeSheet_Update_Tests.src_linepat, "7", IVisio.VisUnitCodes.visNumber);
            update.SetResult(VA.ShapeSheet.SRCConstants.PinX, 2, IVisio.VisUnitCodes.visNumber);
            update.Execute(shape1);

            // Build the query
            var query = new VA.ShapeSheet.Query.CellQuery();
            var col_linepat = query.AddCell(ShapeSheet_Update_Tests.src_linepat, "LinePattern");
            var col_pinx = query.AddCell(VA.ShapeSheet.SRCConstants.PinX, "PinX");

            // Retrieve the values
            var data = query.GetCellData<double>(shape1);

            // Verify
            AssertVA.AreEqual("7", 7, data[col_linepat]);
            AssertVA.AreEqual("2 in", 2, data[col_pinx]);

            page1.Delete(0);
        }
        public void ShapeSheet_Query_SectionRowHandling()
        {
            var page1 = this.GetNewPage();
            var s1    = page1.DrawRectangle(0, 0, 2, 2);
            var s2    = page1.DrawRectangle(2, 1, 3, 3);
            var s3    = page1.DrawRectangle(3, 1, 4, 2);
            var s4    = page1.DrawRectangle(4, -1, 5, 1);

            VACUSTPROP.CustomPropertyHelper.Set(s1, "S1P1", "1");
            VACUSTPROP.CustomPropertyHelper.Set(s2, "S2P1", "2");
            VACUSTPROP.CustomPropertyHelper.Set(s2, "S2P2", "3");
            //set nothing for s3
            VACUSTPROP.CustomPropertyHelper.Set(s4, "S3P1", "4");
            VACUSTPROP.CustomPropertyHelper.Set(s4, "S3P2", "5");
            VACUSTPROP.CustomPropertyHelper.Set(s4, "S3P3", "6");

            var query = new VA.ShapeSheet.Query.CellQuery();

            var prop_sec  = query.AddSection(IVisio.VisSectionIndices.visSectionProp);
            var value_col = prop_sec.AddCell(VA.ShapeSheet.SRCConstants.Prop_Value, "Value");

            var shapeids = new[] { s1.ID, s2.ID, s3.ID, s4.ID };

            var data = query.GetCellData <double>(
                page1,
                shapeids);

            Assert.AreEqual(4, data.Count);
            Assert.AreEqual(1, data[0].Sections[prop_sec].Count);
            Assert.AreEqual(2, data[1].Sections[prop_sec].Count);
            Assert.AreEqual(0, data[2].Sections[prop_sec].Count);
            Assert.AreEqual(3, data[3].Sections[prop_sec].Count);

            AssertVA.AreEqual("\"1\"", 1.0, data[0].Sections[prop_sec][0][0]);
            AssertVA.AreEqual("\"2\"", 2.0, data[1].Sections[prop_sec][0][0]);
            AssertVA.AreEqual("\"3\"", 3.0, data[1].Sections[prop_sec][1][0]);
            AssertVA.AreEqual("\"4\"", 4.0, data[3].Sections[prop_sec][0][0]);
            AssertVA.AreEqual("\"5\"", 5.0, data[3].Sections[prop_sec][1][0]);
            AssertVA.AreEqual("\"6\"", 6.0, data[3].Sections[prop_sec][2][0]);

            page1.Delete(0);
        }
        public void ShapeSheet_Query_SectionRowHandling()
        {
            var page1 = this.GetNewPage();
            var s1 = page1.DrawRectangle(0, 0, 2, 2);
            var s2 = page1.DrawRectangle(2, 1, 3, 3);
            var s3 = page1.DrawRectangle(3, 1, 4, 2);
            var s4 = page1.DrawRectangle(4, -1, 5, 1);

            VACUSTPROP.CustomPropertyHelper.Set(s1, "S1P1", "1");
            VACUSTPROP.CustomPropertyHelper.Set(s2, "S2P1", "2");
            VACUSTPROP.CustomPropertyHelper.Set(s2, "S2P2", "3");
            //set nothing for s3
            VACUSTPROP.CustomPropertyHelper.Set(s4, "S3P1", "4");
            VACUSTPROP.CustomPropertyHelper.Set(s4, "S3P2", "5");
            VACUSTPROP.CustomPropertyHelper.Set(s4, "S3P3", "6");

            var query = new VA.ShapeSheet.Query.CellQuery();

            var prop_sec = query.AddSection(IVisio.VisSectionIndices.visSectionProp);
            var value_col = prop_sec.AddCell(VA.ShapeSheet.SRCConstants.Prop_Value,"Value");

            var shapeids = new[] { s1.ID, s2.ID, s3.ID, s4.ID };

            var data = query.GetCellData<double>(
                page1,
                shapeids);

            Assert.AreEqual(4, data.Count);
            Assert.AreEqual(1, data[0].Sections[prop_sec].Count);
            Assert.AreEqual(2, data[1].Sections[prop_sec].Count);
            Assert.AreEqual(0, data[2].Sections[prop_sec].Count);
            Assert.AreEqual(3, data[3].Sections[prop_sec].Count);

            AssertVA.AreEqual("\"1\"", 1.0, data[0].Sections[prop_sec][0][0]);
            AssertVA.AreEqual("\"2\"", 2.0, data[1].Sections[prop_sec][0][0]);
            AssertVA.AreEqual("\"3\"", 3.0, data[1].Sections[prop_sec][1][0]);
            AssertVA.AreEqual("\"4\"", 4.0, data[3].Sections[prop_sec][0][0]);
            AssertVA.AreEqual("\"5\"", 5.0, data[3].Sections[prop_sec][1][0]);
            AssertVA.AreEqual("\"6\"", 6.0, data[3].Sections[prop_sec][2][0]);

            page1.Delete(0);
        }