public void TryGetValue_Nested_Scope_Value_Overrides_Parent( ) { const string symbolName = "Global1"; var stack = new ScopeStack <int> { [symbolName] = 1 }; using (stack.EnterScope( )) { stack[symbolName] = 2; Assert.IsTrue(stack.TryGetValue(symbolName, out int value)); Assert.AreEqual(2, value); using (stack.EnterScope( )) { stack[symbolName] = 3; Assert.IsTrue(stack.TryGetValue(symbolName, out int nestedValue)); Assert.AreEqual(3, nestedValue); } Assert.IsTrue(stack.TryGetValue(symbolName, out int valueAfterExitNested)); Assert.AreEqual(2, valueAfterExitNested); } Assert.IsTrue(stack.TryGetValue(symbolName, out int globalValue)); Assert.AreEqual(1, globalValue); }