示例#1
0
        //actual constructor work, but hidden to not be used accidently in a stupid way
        private SessionState(SessionStateGlobal sessionStateGlobal, SessionState parent)
        {
            SessionStateGlobal = sessionStateGlobal;

            var parentAliasScope    = parent == null ? null : parent._aliasScope;
            var parentFunctionScope = parent == null ? null : parent._functionScope;
            var parentVariableScope = parent == null ? null : parent._variableScope;
            var parentDriveScope    = parent == null ? null : parent._driveScope;
            var parentModuleScope   = parent == null ? null : parent._moduleScope;
            var parentCmdletScope   = parent == null ? null : parent._cmdletScope;

            _aliasScope    = new SessionStateScope <AliasInfo>(this, parentAliasScope, SessionStateCategory.Alias);
            _functionScope = new SessionStateScope <FunctionInfo>(this, parentFunctionScope, SessionStateCategory.Function);
            _variableScope = new SessionStateScope <PSVariable>(this, parentVariableScope, SessionStateCategory.Variable);
            _driveScope    = new SessionStateScope <PSDriveInfo>(this, parentDriveScope, SessionStateCategory.Drive);
            _moduleScope   = new SessionStateScope <PSModuleInfo>(this, parentModuleScope, SessionStateCategory.Module);
            _cmdletScope   = new SessionStateScope <CmdletInfo>(this, parentCmdletScope, SessionStateCategory.Cmdlet);

            IsScriptScope = false;
            Function      = new FunctionIntrinsics(_functionScope);
            Alias         = new AliasIntrinsics(_aliasScope);

            Drive         = new DriveManagementIntrinsics(_driveScope);
            Path          = new PathIntrinsics(this);
            PSVariable    = new PSVariableIntrinsics(_variableScope);
            LoadedModules = new ModuleIntrinsics(_moduleScope);
            Cmdlet        = new CmdletIntrinsics(_cmdletScope);
        }
示例#2
0
 internal SessionState(SessionState sessionState)
 {
     SessionStateGlobal = sessionState.SessionStateGlobal;
     Drive      = sessionState.Drive;
     Path       = sessionState.Path;
     Provider   = sessionState.Provider;
     PSVariable = sessionState.PSVariable;
 }
示例#3
0
 // internal
 internal SessionState(SessionStateGlobal sessionState)
 {
     SessionStateGlobal = sessionState;
     Drive      = new DriveManagementIntrinsics(sessionState);
     Path       = new PathIntrinsics(sessionState);
     Provider   = new CmdletProviderManagementIntrinsics(sessionState);
     PSVariable = new PSVariableIntrinsics(sessionState);
 }
示例#4
0
 // internal
 internal SessionState(SessionStateGlobal sessionState)
 {
     SessionStateGlobal = sessionState;
     Drive = new DriveManagementIntrinsics(sessionState);
     Path = new PathIntrinsics(sessionState);
     Provider = new CmdletProviderManagementIntrinsics(sessionState);
     PSVariable = new PSVariableIntrinsics(sessionState);
 }
示例#5
0
        public static Mock<IOctopusRepository> AddOctopusRepo(PSVariableIntrinsics psVariable)
        {
            var octoRepo = new Mock<IOctopusRepository>();

            // Add the mock repository to the session to simulate 'Connect-OctoServer'
            psVariable.Set("OctopusRepository", octoRepo.Object);

            return octoRepo;
        }
示例#6
0
        //actual constructor work, but hidden to not be used accidently in a stupid way
        private SessionState(SessionStateGlobal sessionStateGlobal, SessionStateScope<FunctionInfo> functions,
                             SessionStateScope<PSVariable> variables, SessionStateScope<PSDriveInfo> drives,
                             SessionStateScope<AliasInfo> aliases)
        {
            SessionStateGlobal = sessionStateGlobal;

            _aliasScope = new SessionStateScope<AliasInfo>(aliases, SessionStateCategory.Alias);
            _functionScope = new SessionStateScope<FunctionInfo>(functions, SessionStateCategory.Function);
            _variableScope = new SessionStateScope<PSVariable>(variables, SessionStateCategory.Variable);
            _driveScope = new SessionStateScope<PSDriveInfo>(drives, SessionStateCategory.Drive);

            IsScriptScope = false;
            Function = new FunctionIntrinsics(this, _functionScope);
            Alias = new AliasIntrinsics(this, _aliasScope);

            Drive = new DriveManagementIntrinsics(this, _driveScope);
            Path = new PathIntrinsics(SessionStateGlobal);
            Provider = new CmdletProviderManagementIntrinsics(SessionStateGlobal);
            PSVariable = new PSVariableIntrinsics(this, _variableScope);
        }
示例#7
0
        //actual constructor work, but hidden to not be used accidently in a stupid way
        private SessionState(SessionStateGlobal sessionStateGlobal, SessionStateScope <FunctionInfo> functions,
                             SessionStateScope <PSVariable> variables, SessionStateScope <PSDriveInfo> drives,
                             SessionStateScope <AliasInfo> aliases)
        {
            SessionStateGlobal = sessionStateGlobal;

            _aliasScope    = new SessionStateScope <AliasInfo>(aliases, SessionStateCategory.Alias);
            _functionScope = new SessionStateScope <FunctionInfo>(functions, SessionStateCategory.Function);
            _variableScope = new SessionStateScope <PSVariable>(variables, SessionStateCategory.Variable);
            _driveScope    = new SessionStateScope <PSDriveInfo>(drives, SessionStateCategory.Drive);

            IsScriptScope = false;
            Function      = new FunctionIntrinsics(this, _functionScope);
            Alias         = new AliasIntrinsics(this, _aliasScope);

            Drive      = new DriveManagementIntrinsics(this, _driveScope);
            Path       = new PathIntrinsics(SessionStateGlobal);
            Provider   = new CmdletProviderManagementIntrinsics(SessionStateGlobal);
            PSVariable = new PSVariableIntrinsics(this, _variableScope);
        }