示例#1
0
 public void actionsToExecuteOnCirAnalysisControl(object ascxControl)
 {
     if (ascxControl is ascx_CirAnalysis)
     {
         var cirAnalysis = (ascx_CirAnalysis)ascxControl;
         O2AscxGUI.logInfo(cirAnalysis.GetType().FullName);
         cirAnalysis.loadO2CirDataFile(DI.config.ExecutingAssembly);
         //DI.log.info();
     }
 }
示例#2
0
        public void test_startSampleFileUnderDebuggerAndStepIntoIt()
        {
            // before we start the process we need to set the callback for global O2Messages (so that we pick up the OnBreakpoint message)
            PublicDI.o2MessageQueue.onMessages += o2Message =>
            {
                DI.log.info("message received: {0}", o2Message.messageText);
                if (o2Message is IM_O2MdbgAction)
                {
                    var o2MDbgAction = (IM_O2MdbgAction)o2Message;
                    if (o2MDbgAction.o2MdbgAction == IM_O2MdbgActions.breakEvent)
                    {
                        var filename = o2MDbgAction.filename;
                        var line     = o2MDbgAction.line;
                        DI.log.info("SOURCECODE REF -> {0} : {1})", line, filename);
                        setSelectedLineNumber(filename, line);
                    }
                }
            };

            // start process under debuggger
            var startThread = O2MDbgUtils.startProcessUnderDebugger(assemblyToExecute);

            // wait for it completes execution
            startThread.Join();
            Assert.That(O2MDbgUtils.IsActive(), "Debugger should be active");
            Assert.That(false == O2MDbgUtils.IsRunning(), "Debugger should Not be running");

            var selectedLine = getSelectedLineNumber();

            O2MDbgUtils.stepIntoAnimated();

            /*      Assert.That(selectedLine != currentSelectedLine,
             *                "After debugger started the selectedLine != currentSelectedLine: " + selectedLine + " != " +
             *                currentSelectedLine);*/



            //    Processes.Sleep(3000);
            //O2AscxGUI.invokeOnAscxControl(ascxScriptControl,)
            O2AscxGUI.logInfo("all ready");
        }
示例#3
0
        public void test_CirCreatorWorkflow()
        {
            var             guiControlReady = new AutoResetEvent(false);
            ascx_CirCreator cirCreator      = null;

            O2Messages.getAscx(cirAnalysisControlName, ascxControl =>
            {
                if (ascxControl is ascx_CirCreator)
                {
                    cirCreator = (ascx_CirCreator)ascxControl;
                    guiControlReady.Set();
                }
                else
                {
                    DI.log.error("Could not get cirCreator control, aborting!");
                    return;
                }
            });
            guiControlReady.WaitOne(); //give it 2 seconds to setup
            Assert.That(cirCreator != null, "CirCreator control was null");

            // now that we have the control run the Automation tests
            O2AscxGUI.logInfo("Hello from UnitTests : " + cirCreator.GetType().FullName);
            // get directories controls
            var directory_CirCreationQueue = cirCreator.getDirectoryControlFor_CirCreationQueue();
            var directory_CreatedCirFiles  = cirCreator.getDirectoryControlFor_CreatedCirFiles();

            // make sure there are no files in the queue
            Assert.That(directory_CirCreationQueue.getFiles().Count == 0,
                        "There should be no files in the directory Queue");

            var convertTarget      = DI.config.ExecutingAssembly;
            var createdCirDataFile = Path.Combine(directory_CreatedCirFiles.getCurrentDirectory(),
                                                  Path.GetFileName(convertTarget) + ".CirData");

            if (File.Exists(createdCirDataFile))
            {
                DI.log.info("target createdCirDataFile already exists, so deleting it : " + createdCirDataFile);
                Files.deleteFile(createdCirDataFile);
            }
            Assert.That(false == File.Exists(createdCirDataFile), "createdCirDataFile should not exist: " + createdCirDataFile);
            // get the number of files in CreatedCirFiles
            var filesInCreatedCirFilesDir = directory_CreatedCirFiles.getFiles().Count;


            // this will copy the file and trigger the CirCreationQueue
            Files.Copy(convertTarget, directory_CirCreationQueue.getCurrentDirectory());

            Assert.That(directory_CirCreationQueue.getFiles().Count == 1,
                        "Now there should be one file in the directory Queue");


            // wait some time to allow conversion to take place  (ideally we should be hooking into the directory_CreatedCirFiles._onFileWatchEvent
            Thread.Sleep(2000);



            Assert.That(File.Exists(createdCirDataFile), "createdCirDataFile shouold be ther now: " + createdCirDataFile);
            Assert.That(filesInCreatedCirFilesDir + 1 == directory_CreatedCirFiles.getFiles().Count,
                        "There should only had been one extra file in the CreatedCirFiles dir");
        }