Ejemplo n.º 1
0
        public void DocumentShouldBeSaved()
        {
            // Arrange
            using var doc       = new OfficeDocument(_sourceFile);
            using var viewModel = new OfficeDocumentViewModel(doc);
            viewModel.InsertPart(XmlPart.RibbonX12);
            Assume.That(File.Exists(_destFile), Is.False, "File was not deleted before test");

            // Act
            doc.Save(_destFile);

            // Assert
            Assert.IsTrue(File.Exists(_destFile), "File was not saved");
        }
Ejemplo n.º 2
0
            // Arrange
            static void CheckIntegrity(OfficeDocumentViewModel innerModel)
            {
                Assert.AreEqual(2, innerModel.Children.Count);

                for (var i = 0; i < 2; ++i)
                {
                    var innerPart = (OfficePartViewModel)innerModel.Children[i];

                    if (innerPart.Part?.PartType == XmlPart.RibbonX12)
                    {
                        Assert.AreEqual(1, innerPart.Children.Count);
                        Assert.AreEqual("redo", ((IconViewModel)innerPart.Children[0]).Name);
                    }
                    else
                    {
                        Assert.AreEqual(2, innerPart.Children.Count);
                        Assert.AreEqual("changedId", ((IconViewModel)innerPart.Children[0]).Name);
                        Assert.AreEqual("redo", ((IconViewModel)innerPart.Children[1]).Name);
                    }
                }
            }