コード例 #1
0
ファイル: FakeScope.cs プロジェクト: bluePlayer/FakeItEasy
        /// <summary>
        /// Creates a new scope and sets it as the current scope, using the specified
        /// container as the container for the new scope.
        /// </summary>
        /// <param name="container">The container to use for the new scope.</param>
        /// <returns>The created scope.</returns>
        public static IFakeScope Create(IFakeObjectContainer container)
        {
            var result = new ChildScope(Current, container);

            Current = result;
            return(result);
        }
コード例 #2
0
        /// <summary>
        /// Creates a new scope and sets it as the current scope.
        /// </summary>
        /// <returns>The created scope.</returns>
        public static FakeScope Create()
        {
            var result = new ChildScope(FakeScope.Current);

            FakeScope.Current = result;
            return(result);
        }
コード例 #3
0
        void ExitChildScope(ChildScope scope)
        {
            if (scope != scopeStack.Peek())
            {
                throw new InvalidOperationException("Invalid expectation scope dispose order");
            }

            scopeStack.Pop();
        }
コード例 #4
0
 /// <summary>
 /// removes the binding to the type if any.
 /// </summary>
 /// <param name="type">The type to remove from the scope</param>
 public override void InvalidateBinding(System.Type type)
 {
     if (HttpContext.Current.IsInstance() && ChildScope.IsNull())
     {
         HttpContext.Current.Session[type.FullName] = null;
     }
     else
     {
         base.InvalidateBinding(type);
     }
 }
コード例 #5
0
        /// <summary>
        /// Removes the definition of a local variable from this command block
        /// </summary>
        /// <param name="localVar"></param>
        /// <returns></returns>
        public bool UndefineLocalVariable(SymbolLocalVariable localVar)
        {
            var declareCommand =
                DeclareVariableCommands.FirstOrDefault(
                    command => command.DataStore.ObjectName == localVar.ObjectName
                    );

            if (ReferenceEquals(declareCommand, null) == false)
            {
                RemoveCommand(declareCommand);
            }

            return(ChildScope.RemoveLocalVariable(localVar));
        }
コード例 #6
0
ファイル: FakeScope.cs プロジェクト: rajeshpillai/FakeItEasy
 /// <summary>
 /// Creates a new scope and sets it as the current scope, using the specified
 /// container as the container for the new scope.
 /// </summary>
 /// <param name="container">The container to usee for the new scope.</param>
 /// <returns>The created scope.</returns>
 public static IFakeScope Create(IFakeObjectContainer container)
 {
     var result = new ChildScope(Current, container);
     Current = result;
     return result;
 }
コード例 #7
0
ファイル: Declaration.cs プロジェクト: HarryMills-UL/Element
 public void Initialize(IScope parent)
 {
     ParentScope = parent ?? throw new ArgumentNullException(nameof(parent));
     ChildScope?.Initialize(this);
 }
コード例 #8
0
 IDisposable BeginChildScope(ChildScope childScope)
 {
     RootScope.Add(childScope, false);
     scopeStack.Push(childScope);
     return(childScope);
 }