public void ParsedSuccessfully()         // TODO naming
        {
            var selection = new Mock <Range>(MockBehavior.Strict);
            var values    = new object[, ] {
                { 1, "1", "abc" }, { "123.123", "321 , 321", null }
            };

            selection.SetupGet(x => x.get_Value(Missing.Value)).Returns(values);
            selection.SetupSet(x => x.Value = It.Is <object[, ]>(z => VerifyParsed(z)));
            Expression <Func <Range, string> > getAddress = x => x.get_Address(It.IsAny <object>(), It.IsAny <object>(),
                                                                               It.IsAny <XlReferenceStyle>(), It.IsAny <object>(), It.IsAny <object>());

            selection.SetupGet(getAddress).Returns("Address");
            selection.SetupGet(x => x.Row).Returns(1);
            selection.SetupGet(x => x.Column).Returns(1);

            var ws = new Mock <Worksheet>(MockBehavior.Strict);
            var wb = new Mock <Workbook>(MockBehavior.Strict);

            ws.Setup(x => x.Name).Returns("WsName");
            wb.Setup(x => x.Name).Returns("WbName");
            selection.Setup(x => x.Worksheet).Returns(ws.Object);
            ws.Setup(x => x.Parent).Returns(wb.Object);

            var areas = new Mock <Areas>(MockBehavior.Strict);

            areas.Setup(x => x.GetEnumerator()).Returns(new[] { selection.Object }.GetEnumerator());
            selection.Setup(x => x.Areas).Returns(areas.Object);

            NumericParser.Parse(selection.Object);
        }
Пример #2
0
        public void HexNumeric_AllowsCapital()
        {
            NumericParser parser = new NumericParser();
            string        token  = "0xF2";

            NumericNode node = (NumericNode)parser.Parse(token);

            Assert.AreEqual(242, node.Value);
        }
Пример #3
0
        public void HexNumeric_MustStartWith0x()
        {
            NumericParser parser = new NumericParser();
            string        token  = "f2";

            NumericNode node = (NumericNode)parser.Parse(token);

            Assert.IsNull(node);
        }
Пример #4
0
        public void HexNumeric_StartWith0x()
        {
            NumericParser parser = new NumericParser();
            string        token  = "0xf2";

            NumericNode node = (NumericNode)parser.Parse(token);

            Assert.AreEqual(242, node.Value);
        }