public void BindScope_Lookup_CallsGrandChildLookupFirst() { MockScope mockScope1 = new MockScope(); MockScope mockScope2 = new MockScope("grand-child"); BindScope bindScope = new BindScope(mockScope1, mockScope2); ExprOp lookupResult = bindScope.Lookup(SymbolKindEnum.FUNCTION, "dummy"); Assert.Equal(mockScope2.LookupResult, lookupResult); Assert.Equal(1, mockScope2.LookupCalls.Count); }
public void BindScope_Lookup_CallsParentLookupNext() { MockScope mockScope1 = new MockScope(); MockScope mockScope2 = new MockScope("grand-child"); mockScope2.LookupResult = null; BindScope bindScope = new BindScope(mockScope1, mockScope2); ExprOp lookupResult = bindScope.Lookup(SymbolKindEnum.FUNCTION, "dummy"); Assert.AreEqual(mockScope1.LookupResult, lookupResult); Assert.AreEqual(1, mockScope1.LookupCalls.Count); Assert.AreEqual(1, mockScope2.LookupCalls.Count); }