예제 #1
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);
        }
예제 #2
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);
        }
예제 #3
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());
        }