Exemple #1
0
        public void TestCellConstructorValidInput(int rowIndex, int columnIndex)
        {
            var cell = new MockCell(rowIndex, columnIndex);

            Assert.AreEqual(cell.RowIndex, rowIndex, "Incorrect row");
            Assert.AreEqual(cell.ColumnIndex, columnIndex, "Incorrect column");
        }
Exemple #2
0
        public void TestLoadXmlClearOldCells()
        {
            Cell         defaultCell = new MockCell(0, 0);
            const string mockFile    = "temp.xml";
            Stream       writer      = File.Create(mockFile);

            this.cells[0, 0].Text = "test string";

            this.sheet.LoadXml(writer);
            writer.Close();
            File.Delete(mockFile);

            Assert.AreEqual(defaultCell.Text, this.cells[0, 0].Text);
        }
Exemple #3
0
        public void TestLoadXmlClearCommands()
        {
            this.sheet.SetCellBGColor(this.cells[0, 0], 0x0000ffffU);
            Cell         defaultCell = new MockCell(0, 0);
            const string mockFile    = "temp.xml";
            Stream       writer      = File.Create(mockFile);

            this.cells[0, 0].Text = "test string";

            this.sheet.LoadXml(writer);
            writer.Close();
            File.Delete(mockFile);

            Assert.IsFalse(this.sheet.Redos);
            Assert.IsFalse(this.sheet.Undos);
        }
Exemple #4
0
        public void TestClearCellData()
        {
            Cell defaultCell = new MockCell(0, 0);

            foreach (Cell cell in this.cells)
            {
                cell.Text    = "Test string";
                cell.BGColor = 0x0000ffffU;
            }

            Utility.GetMethod <Spreadsheet>("ClearCellData").Invoke(this.sheet, new object[] { });

            foreach (Cell cell in this.cells)
            {
                Assert.AreEqual(defaultCell.Text, cell.Text);
                Assert.AreEqual(defaultCell.Text, cell.Text);
            }
        }