public void IfCellTypeIsBlankShouldWriteBlankCellXml() { _objectToTest = new SheetDataWriter(); _cell.CellStyle.Index.Returns((short)0); _cell.CellType.Returns(CellType.Blank); _objectToTest.WriteCell(0, _cell); _objectToTest.Close(); var lines = File.ReadAllLines(_objectToTest.TemporaryFilePath()); Assert.True(lines.Length == 1); Assert.AreEqual("<c r=\"A1\"></c>", lines[0]); }
public void IfCellTypeIsStringShouldWriteStringCellXml() { _objectToTest = new SheetDataWriter(); _cell.CellStyle.Index.Returns((short)0); _cell.CellType.Returns(CellType.String); _cell.StringCellValue.Returns("''<>\t\n\r&\"? test:SLDFKj "); _objectToTest.WriteCell(0, _cell); _objectToTest.Close(); var lines = File.ReadAllLines(_objectToTest.TemporaryFilePath()); Assert.True(lines.Length == 1); Assert.AreEqual("<c r=\"A1\" t=\"inlineStr\"><is><t xml:space=\"preserve\">\'\'<>	

&"? test:SLDFKj </t></is></c>", lines[0]); }
public void IfCellTypeIsErrorShouldWriteErrorCellXml() { _objectToTest = new SheetDataWriter(); _cell.CellStyle.Index.Returns((short)0); _cell.CellType.Returns(CellType.Error); _cell.ErrorCellValue.Returns((byte)0x00); _objectToTest.WriteCell(0, _cell); _objectToTest.Close(); var lines = File.ReadAllLines(_objectToTest.TemporaryFilePath()); Assert.True(lines.Length == 1); Assert.AreEqual("<c r=\"A1\" t=\"e\"><v>#NULL!</v></c>", lines[0]); }
public void IfCellTypeIsBooleanFalseShouldWriteBooleanCellFalseXml() { _objectToTest = new SheetDataWriter(); _cell.CellStyle.Index.Returns((short)0); _cell.CellType.Returns(CellType.Boolean); _cell.BooleanCellValue.Returns(false); _objectToTest.WriteCell(0, _cell); _objectToTest.Close(); var lines = File.ReadAllLines(_objectToTest.TemporaryFilePath()); Assert.True(lines.Length == 1); Assert.AreEqual("<c r=\"A1\" t=\"b\"><v>0</v></c>", lines[0]); }
public void IfCellTypeIsFormulaShouldWriteFormulaCellXml() { _objectToTest = new SheetDataWriter(); _cell.CellStyle.Index.Returns((short)0); _cell.CellType.Returns(CellType.Formula); _cell.CellFormula.Returns("SUM(A1:A3)"); _cell.GetCachedFormulaResultTypeEnum().Returns(CellType.Numeric); _cell.NumericCellValue.Returns(1); _objectToTest.WriteCell(0, _cell); _objectToTest.Close(); var lines = File.ReadAllLines(_objectToTest.TemporaryFilePath()); Assert.True(lines.Length == 1); Assert.AreEqual("<c r=\"A1\"><f>SUM(A1:A3)</f><v>1</v></c>", lines[0]); }