public void closeNewO2Kernel()
 {
     var processId = o2WcfProxy.getO2KernelProcessId();
     DI.log.info("o2WcfProxy ProcessID: {0}", o2WcfProxy.getO2KernelProcessId());
     Assert.That(Processes.getProcess(processId) != null, "could not find process with ID " + processId);
     o2WcfProxy.closeO2KernelProcess();
     Processes.Sleep(2000);
     Assert.That(Processes.getProcess(processId) == null, "Process should not be there after o2WcfProxy.closeO2KernelProcess()");
 }
        public void test_openCirDataControlUsingLocalWcfHost()
        {
            O2WcfUtils.createWcfHostForThisO2KernelProcess();
            IO2WcfKernelMessage o2WcfProxy = O2WcfUtils.getClientProxyForThisO2KernelProcess();
            var ascxControlName            = "Cir Analysis";

            Assert.That(o2WcfProxy.allOK(), "o2WcfProxy.allOK() returned false");
            DI.log.info("o2WcfProxy.allOK() = {0}", o2WcfProxy.allOK());
            Assert.That(Processes.getCurrentProcessID() == o2WcfProxy.getO2KernelProcessId(), "Processes ID should be the same");

            o2WcfProxy.O2Messages("openAscxAsForm", new object[] { typeof(ascx_CirAnalysis).FullName, ascxControlName });

            o2WcfProxy.O2Messages("executeOnAscxSync", new object[] { ascxControlName, "loadO2CirDataFile", new [] { DI.config.ExecutingAssembly } });
            //o2WcfProxy.O2Messages("getAscxSync", new object[] {ascxControlName});

            //var cirClasses = o2WcfProxy.O2Messages("executeOnAscxSync", new object[] { ascxControlName, "getClasses", new string[0]});
            var cirClasses = o2WcfProxy.getStringListFromAscxControl(ascxControlName, "getClasses", new string[0]);

            Assert.That(cirClasses != null, "prob with fetched cirClasses object");
            Assert.That(cirClasses.Count > 0, "There were no classes returned in cirClasses");
            DI.log.info("There were {0} classes returned", cirClasses.Count);

            var cirFunctions = o2WcfProxy.getStringListFromAscxControl(ascxControlName, "getFunctions", new string[0]);

            Assert.That(cirFunctions != null && cirFunctions.Count > 0, "prob with fetched cirFunctions object");
            DI.log.info("There were {0} functions returned", cirFunctions.Count);

            o2WcfProxy.O2Messages("closeAscxParent", new object[] { ascxControlName });

            WCF_DI.o2WcfKernelMessage.stopHost();
            //o2WcfProxy.closeO2KernelProcess();
        }
        public void test_openCirDataControlOnRemoteWcfHost()
        {
            DI.log.info("Creating new O2Kernel Process with Name: {0}", DI.config.O2KernelAssemblyName);
            Processes.startProcess(DI.config.O2KernelAssemblyName, newO2KernelProcessName);
            IO2WcfKernelMessage o2WcfProxy = O2WcfUtils.createClientProxy(newO2KernelProcessName);

            Assert.That(o2WcfProxy.allOK(), "o2WcfProxy.allOK() returned false");
            DI.log.info("o2WcfProxy.allOK() = {0}", o2WcfProxy.allOK());
            // confirm that o2WcfProxy is running of a different process
            var currentProcessID = Processes.getCurrentProcessID();
            var remoteProcessID  = o2WcfProxy.getO2KernelProcessId();

            DI.log.info("Processes ID -> Current:  {0} remote: {1}", currentProcessID, remoteProcessID);
            Assert.That(currentProcessID != remoteProcessID, "Processes ID should not be the same");

            runTestsViaWcfProxy(o2WcfProxy);
            // close remote proxy and process
            var process = Processes.getProcess(o2WcfProxy.getO2KernelProcessId());

            o2WcfProxy.closeO2KernelProcess();
            process.WaitForExit();      // wait for its exit
        }