コード例 #1
0
ファイル: BindScopeTests.cs プロジェクト: vyolbius/nledger
        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);
        }
コード例 #2
0
ファイル: BindScopeTests.cs プロジェクト: wittyansh/nledger
        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);
        }