public void CellFrom_MissingTypeAttribute_ReturnsNumberType()
        {
            SheetDocumentXmlReader gateway = DefaultGateway();

            XmlElement cellNode = CellElement(address: "A1", value: "1");

            Cell cell = gateway.CellFrom(cellNode);

            Assert.That(cell.Type, Is.EqualTo(CellType.Number));
        }
        public void CellFrom_InlineString_HasStringValue()
        {
            SheetDocumentXmlReader gateway = DefaultGateway();

            XmlElement cellNode = InlineStringCellElement(address: "A1", value: "test string");

            Cell cell = gateway.CellFrom(cellNode);

            Assert.That(cell.Value, Is.EqualTo("test string"));
        }
        public void CellFrom_StyleMissing_ReturnsStyleNull()
        {
            SheetDocumentXmlReader gateway = DefaultGateway();

            XmlElement cellNode = CellElement(address: "A1", value: "2");

            Cell cell = gateway.CellFrom(cellNode);

            Assert.That(cell.Style, Is.Null);
        }
        public void CellFrom_CellAddress_A1_ReturnsRow()
        {
            SheetDocumentXmlReader gateway = DefaultGateway();

            XmlElement cellNode = CellElement(address: "A1", value: "1");

            Cell cell = gateway.CellFrom(cellNode);

            Assert.That(cell.Row, Is.EqualTo(1));
        }
        public void CellFrom_SharedString_HasSharedStringType()
        {
            SheetDocumentXmlReader gateway = DefaultGateway();

            XmlElement cellNode = SharedStringCellElement(address: "A1", value: "test string");

            Cell cell = gateway.CellFrom(cellNode);

            Assert.That(cell.Type, Is.EqualTo(CellType.SharedString));
        }
        public void CellFrom_Style2_ReturnsStyle2()
        {
            SheetDocumentXmlReader gateway = DefaultGateway();

            XmlElement cellNode = CellElement(address: "A1", value: "2");

            cellNode.SetAttribute("s", "2");

            Cell cell = gateway.CellFrom(cellNode);

            Assert.That(cell.Style, Is.EqualTo(2));
        }
        public void CellFrom_NumberTypeExplicit_ReturnsNumberType()
        {
            SheetDocumentXmlReader gateway = DefaultGateway();

            XmlElement cellNode = CellElement(address: "A1", value: "2");

            cellNode.SetAttribute("t", "n");

            Cell cell = gateway.CellFrom(cellNode);

            Assert.That(cell.Type, Is.EqualTo(CellType.Number));
        }
        public void CellFrom_SharedString_HasValue()
        {
            var sharedStringGateway = new SharedStringGatewayFake();

            sharedStringGateway.CountReturns           = 123;
            sharedStringGateway.StringAtIndexOfReturns = "real test string";

            var gateway = new SheetDocumentXmlReader(sharedStringGateway);

            XmlElement cellNode = SharedStringCellElement(address: "A1", value: "123");

            Cell cell = gateway.CellFrom(cellNode);

            Assert.That(cell.Value, Is.EqualTo("real test string"));
            Assert.That(sharedStringGateway.StringAtIndexOfValueParameter, Is.EqualTo("123"));
        }
        public void CellFrom_NullInput_ReturnsEmptyCell()
        {
            SheetDocumentXmlReader gateway = DefaultGateway();

            Assert.That(gateway.CellFrom(null).IsEmpty, Is.True);
        }