Exemplo n.º 1
0
        public void Table_Row_Remove_Test()
        {
            // ARRANGE
            var pre           = new PresentationEx(Properties.Resources._009);
            var sld3Shapes    = pre.Slides[2].Shapes;
            var table3        = sld3Shapes.First(s => s.Id.Equals(3)).Table;
            var rows          = table3.Rows;
            var numRowsBefore = rows.Count;

            // ACT
            rows.RemoveAt(0);

            var ms = new MemoryStream();

            pre.SaveAs(ms);
            pre.Close();

            pre    = new PresentationEx(ms);
            table3 = pre.Slides[2].Shapes.First(s => s.Id.Equals(3)).Table;
            rows   = table3.Rows;
            var numRowsAfter = rows.Count;

            // ASSERT
            Assert.True(numRowsBefore > numRowsAfter);
        }
Exemplo n.º 2
0
        public void Shape_XandWsetter_Test()
        {
            // ARRANGE
            var pre    = new PresentationEx(Properties.Resources._006_1_slides);
            var shape2 = pre.Slides[0].Shapes.First(x => x.Id == 3);

            // ACT
            shape2.X     = 4000000;
            shape2.Width = 6000000;
            var isPlaceholder = shape2.IsPlaceholder;
            var isGrouped     = shape2.IsGrouped;

            var ms = new MemoryStream();

            pre.SaveAs(ms);
            pre.Close();

            ms.SeekBegin();
            pre    = new PresentationEx(ms);
            shape2 = pre.Slides[0].Shapes.First(x => x.Id == 3);
            pre.Close();

            // ASSERT
            Assert.False(isPlaceholder);
            Assert.False(isGrouped);
            Assert.Equal(4000000, shape2.X);
            Assert.Equal(6000000, shape2.Width);
        }
Exemplo n.º 3
0
        public void ShapeCustomData_ShouldReturnData_ShapeCustomDataIsSet()
        {
            // Arrange
            const string customDataString = "Test custom data";
            var          origPreStream    = new MemoryStream();

            origPreStream.Write(Properties.Resources._009);
            var originVersionPre = new PresentationEx(origPreStream);
            var shape            = originVersionPre.Slides.First().Shapes.First();

            // Act
            shape.CustomData = customDataString;
            var changedVersionPreStream = new MemoryStream();

            originVersionPre.SaveAs(changedVersionPreStream);
            var changedVersionPre = new PresentationEx(changedVersionPreStream);
            var shapeCustomData   = changedVersionPre.Slides.First().Shapes.First().CustomData;

            // Assert
            shapeCustomData.Should().Be(customDataString);
        }
Exemplo n.º 4
0
        public void SlideCustomData_ShouldReturnData_CustomDataIsAssigned()
        {
            // Arrange
            const string customDataString = "Test custom data";
            var          origPreStream    = new MemoryStream();

            origPreStream.Write(Properties.Resources._001);
            var originPre = new PresentationEx(origPreStream);
            var slide     = originPre.Slides.First();

            // Act
            slide.CustomData = customDataString;
            var savedPreStream = new MemoryStream();

            originPre.SaveAs(savedPreStream);
            var savedPre   = new PresentationEx(savedPreStream);
            var customData = savedPre.Slides.First().CustomData;

            // Assert
            customData.Should().Be(customDataString);
        }