示例#1
0
 public TheTerminateMethod()
 {
     _contextMock1    = new Mock <IScriptPackContext>();
     _contextMock2    = new Mock <IScriptPackContext>();
     _scriptPackMock1 = new Mock <IScriptPack>();
     _scriptPackMock1.Setup(p => p.GetContext()).Returns(_contextMock1.Object);
     _scriptPackMock2 = new Mock <IScriptPack>();
     _scriptPackMock2.Setup(p => p.GetContext()).Returns(_contextMock2.Object);
     _scriptPackSession = new ScriptPackSession(new List <IScriptPack> {
         _scriptPackMock1.Object, _scriptPackMock2.Object
     });
     _scriptPackSession.TerminatePacks();
 }
示例#2
0
        public void Execute(string script, IEnumerable<string> paths, IEnumerable<IScriptPack> scriptPacks)
        {
            var bin = Path.Combine(_fileSystem.GetWorkingDirectory(script), "bin");

            var references = DefaultReferences.Union(paths);

            _scriptEngine.BaseDirectory = bin;

            var scriptPackSession = new ScriptPackSession(scriptPacks);

            scriptPackSession.InitializePacks();

            var path = Path.IsPathRooted(script) ? script : Path.Combine(_fileSystem.CurrentDirectory, script);
            var code = _filePreProcessor.ProcessFile(path);

            _scriptEngine.Execute(code, references, DefaultNamespaces, scriptPackSession);

            scriptPackSession.TerminatePacks();
        }
示例#3
0
 public virtual void Terminate()
 {
     _log.Debug("Terminating packs");
     ScriptPackSession.TerminatePacks();
 }