public void HasNextShouldBeTrueIfNotLastCell() { var provider = MockRepository.GenerateStub <ExcelDataProvider>(); provider.Stub(x => x.GetCellValue(0, 0)).Return(new ExcelCell(3, null, 0, 0)); provider.Stub(x => x.GetCellValue(1, 0)).Return(new ExcelCell(4, null, 0, 0)); var args = GetArgs(3, "A1:B2", 1); var navigator = new LookupNavigator(LookupDirection.Vertical, args, GetContext(provider)); Assert.IsTrue(navigator.MoveNext()); }
public void MoveNextShouldNavigateVertically() { var provider = MockRepository.GenerateStub <ExcelDataProvider>(); provider.Stub(x => x.GetCellValue(0, 0)).Return(new ExcelCell(3, null, 0, 0)); provider.Stub(x => x.GetCellValue(1, 0)).Return(new ExcelCell(4, null, 0, 0)); var args = GetArgs(6, "A1:B2", 1); var navigator = new LookupNavigator(LookupDirection.Vertical, args, GetContext(provider)); navigator.MoveNext(); Assert.AreEqual(4, navigator.CurrentValue); }
public void NavigatorShouldEvaluateFormula() { var provider = MockRepository.GenerateStub <ExcelDataProvider>(); provider.Stub(x => x.GetCellValue(0, 0)).Return(new ExcelCell(3, null, 0, 0)); provider.Stub(x => x.GetCellValue(1, 0)).Return(new ExcelCell(null, "B5", 0, 0)); var args = GetArgs(4, "A1:B2", 1); var context = GetContext(provider); var parser = MockRepository.GenerateMock <FormulaParser>(provider); context.Parser = parser; var navigator = new LookupNavigator(LookupDirection.Vertical, args, context); navigator.MoveNext(); parser.AssertWasCalled(x => x.Parse("B5")); }