상속: IDisposable
 public void ConstructorShouldSetScopeId()
 {
     var scopes = new ParsingScopes(_lifeTimeEventHandler);
     var scope = new ParsingScope(scopes, RangeAddress.Empty);
     var dependency = new FormulaDependency(scope);
     Assert.AreEqual(scope.ScopeId, dependency.ScopeId);
 }
예제 #2
0
 public ParsingScope(ParsingScopes parsingScopes, ParsingScope parent, RangeAddress address)
 {
     _parsingScopes = parsingScopes;
     Parent = parent;
     Address = address;
     ScopeId = Guid.NewGuid();
 }
예제 #3
0
 public ParsingScope(ParsingScopes parsingScopes, ParsingScope parent, RangeAddress address)
 {
     _parsingScopes = parsingScopes;
     Parent         = parent;
     Address        = address;
     ScopeId        = Guid.NewGuid();
 }
 public virtual void KillScope(ParsingScope parsingScope)
 {
     _scopes.Pop();
     if (_scopes.Count() == 0)
     {
         _lifetimeEventHandler.ParsingCompleted();
     }
 }
예제 #5
0
 public virtual void KillScope(ParsingScope parsingScope)
 {
     _scopes.Pop();
     if (_scopes.Count() == 0)
     {
         _lifetimeEventHandler.ParsingCompleted();
     }
 }
 public void ClearShouldClearDictionary()
 {
     var scope = new ParsingScope(_scopes, _factory.Create("A1"));
     _formulaDependencies.AddFormulaScope(scope);
     Assert.AreEqual(1, _formulaDependencies.Dependencies.Count());
     _formulaDependencies.Clear();
     Assert.AreEqual(0, _formulaDependencies.Dependencies.Count());
 }
 public void ConstructorShouldSetAddress()
 {
     var scopes = new ParsingScopes(_lifeTimeEventHandler);
     var expectedAddress = _factory.Create("A1");
     var scope = new ParsingScope(scopes, expectedAddress);
     var dependency = new FormulaDependency(scope);
     Assert.AreEqual(expectedAddress, dependency.Address);
 }
예제 #8
0
 public virtual ParsingScope NewScope(RangeAddress address)
 {
     ParsingScope scope;
     if (_scopes.Count() > 0)
     {
         scope = new ParsingScope(this, _scopes.Peek(), address);
     }
     else
     {
         scope = new ParsingScope(this, address);
     }
     _scopes.Push(scope);
     return scope;
 }
        public void ShouldAddReferenceToParent()
        {
            var parentScope = new ParsingScope(_scopes, _factory.Create("A1"));
            var parentDependency = MockRepository.GenerateStub<FormulaDependency>(parentScope);
            _formulaDependencyFactory.Stub(x => x.Create(parentScope)).Return(parentDependency);
            _formulaDependencies.AddFormulaScope(parentScope);

            var childScope = new ParsingScope(_scopes, parentScope, _factory.Create("A2"));
            var childDependency = MockRepository.GenerateStub<FormulaDependency>(childScope);
            _formulaDependencyFactory.Stub(x => x.Create(childScope)).Return(childDependency);
            _formulaDependencies.AddFormulaScope(childScope);

            parentDependency.AssertWasCalled(x => x.AddReferenceTo(childScope.Address));
        }
예제 #10
0
        public virtual ParsingScope NewScope(RangeAddress address)
        {
            ParsingScope scope;

            if (_scopes.Count() > 0)
            {
                scope = new ParsingScope(this, _scopes.Peek(), address);
            }
            else
            {
                scope = new ParsingScope(this, address);
            }
            _scopes.Push(scope);
            return(scope);
        }
 public void Setup()
 {
     _parsingContext = ParsingContext.Create();
     _scope = _parsingContext.Scopes.NewScope(RangeAddress.Empty);
 }
예제 #12
0
 public void ScopeShouldCallKillScopeOnDispose()
 {
     var scope = new ParsingScope(_parsingScopes, _factory.Create("A1"));
     ((IDisposable)scope).Dispose();
     _parsingScopes.AssertWasCalled(x => x.KillScope(scope));
 }
예제 #13
0
 public void ConstructorShouldSetParent()
 {
     var parent = new ParsingScope(_parsingScopes, _factory.Create("A1"));
     var scope = new ParsingScope(_parsingScopes, parent, _factory.Create("A2"));
     Assert.AreEqual(parent, scope.Parent);
 }
예제 #14
0
 public void ConstructorShouldSetAddress()
 {
     var expectedAddress =  _factory.Create("A1");
     var scope = new ParsingScope(_parsingScopes, expectedAddress);
     Assert.AreEqual(expectedAddress, scope.Address);
 }