private static void TestDefine(Tree<Cell> defineRow) { var processor = Builder.CellProcessor(); var define = new Define(); var input = new CellTree(defineRow, new CellTree("stuff")); define.Interpret(processor, input); Assert.AreEqual(input, processor.Get<Procedures>().GetValue("myprocedure")); }
private static void TestDefine(Func<Tree<Cell>, bool> isName, Tree<Cell> defineRow) { var processor = new Mock<CellProcessor>(); processor .Setup(p => p.Parse(typeof (MemberName), TypedValue.Void, It.Is<Tree<Cell>>(c => isName(c)))) .Returns(new TypedValue(new MemberName("myprocedure"))); var define = new Define {Processor = processor.Object}; var input = new CellTree(defineRow, new CellTree("stuff")); define.Interpret(input); processor.Verify(p => p.Store(It.Is<Procedure>(v => v.Id == "myprocedure" && v.Instance == input))); }