public void SetUp()
        {
            PurgeQueue("jarvistest-input1");
            PurgeQueue("jarvistest-input2");

            _connectionString = ConfigurationManager.ConnectionStrings["rebus"].ConnectionString;
            var url = new MongoUrl(_connectionString);
            var db  = new MongoClient(url).GetDatabase(url.DatabaseName);

            db.Drop();

            //Init processes

            //This is the process 1, it knows that every message should be directed to queue number 2 and he
            //listen on queue number 1, he is capable to handle the generic AnotherSampleMessageHandler.
            var mapping1 = new System.Collections.Generic.Dictionary <string, string>()
            {
                ["Jarvis.Framework.Tests"] = "jarvistest-input2"                 //Command is sent to input2
            };

            process1 = new TestProcess(_useJarvisConfiguration, _connectionString, "jarvistest-input1", mapping1);
            handler1 = new AnotherSampleMessageHandler();
            process1.RegisterHandler(handler1);

            var mapping2 = new System.Collections.Generic.Dictionary <string, string>()
            {
                ["Jarvis.Framework.Tests"] = "jarvistest-input2"                 //Command is sent to input2
            };

            process2 = new TestProcess(_useJarvisConfiguration, _connectionString, "jarvistest-input2", mapping2);
            handler2 = new AnotherSampleMessageHandler();
            process2.RegisterHandler(handler2);
        }
Example #2
0
        public async Task TestTemplatesAsync(Template Template)
        {
            // Arrange
            TestProcess Process = new TestProcess();

            ProjectName     = "TestProject";
            OutputDirectory = tempPath;
            directories.Add("artifacts");
            directories.Add("build");
            directories.Add("docs");
            directories.Add("lib");
            directories.Add("samples");
            directories.Add("packages");
            directories.Add("test");
            Directory.CreateDirectory(tempPath);
            NetCommand = $" new {Template.ShortName}  -o src/ {ProjectName} -n {ProjectName}";
            var Structuring = new Structuring(Process);

            // Act
            logging.WireEventHandlers(Structuring);
            await Structuring.RunStructuringAsync(OutputDirectory, directories, NetCommand, ProjectName);

            // Assert
            Assert.Equal("dotnet", Process.StartInfo.FileName);
            Assert.Contains($"new {Template.ShortName}", Process.StartInfo.Arguments);

            // Cleanup
            logging.CurrentLog = string.Empty;
            Directory.Delete(tempPath, true);
        }
Example #3
0
        protected override void Given()
        {
            _runner = TestProcess.CreateProcessRunner()
                      .WithArguments(args => args.AddOption("--duration", "10"));

            _cts = new CancellationTokenSource();
        }
        /// <summary>
        /// Create TestReporing
        /// </summary>
        /// <param name="outputConfiguration">Output configuration</param>
        public TestReport(TestProcess process, IList<Configuration.TestOutputConfiguration> outputConfiguration)
        {
            testCaseReports = new List<TestCaseReport>();
            this.outputConfiguration = outputConfiguration;
            this.process = process;

            // Try to get all report outputs
            reportOutptus = new List<ReportOutput>();

            foreach (var config in outputConfiguration)
            {
                var definition = process.PlugInManager.GetPlugInDefinition<OutputDefinitionAttribute>(config.Name);

                if (definition != null)
                {
                    // Create instance of render outptu
                    var ro = (ReportOutput)Activator.CreateInstance(
                            definition.Type,
                            this,
                            config.Settings
                        );

                    ro.Name = config.Name;

                    reportOutptus.Add(ro);
                }
                else
                {
                    process.Listener.Error("ReportOutput", "Could not find output-definition: " + config.Name ?? "NULL");
                }
            }
        }
Example #5
0
        public static void DisposeRunspace()
        {
            CmdletUnitTest.TestRunspace.RunPSCode(
                @"[void]([UIAutomation.CurrentData]::ResetData()); " +
                @"rmo UIAutomation; " +
                @"exit; ");
            CmdletUnitTest.TestRunspace.CloseRunspace();

            if (TestProcess != null)
            {
                try { TestProcess.CloseMainWindow(); }
                catch { }
                try { TestProcess.Kill(); }
                catch { }
            }

            var processes = Process.GetProcessesByName(TestFormProcess);

            foreach (var process in processes)
            {
                try { process.CloseMainWindow(); } catch {}
                try { process.Kill(); } catch {}
            }
            TestProcessStartInfo = null;
            TestProcess          = null;
        }
Example #6
0
        static void Main(string[] args)
        {
            int    port = 9090;
            string name = "HTTP_TEST";

            if (args.Length > 0)
            {
                port = int.Parse(args[0]);
                name = args[1];
            }

            TestProcess process = new TestProcess(port, name);

            process.Loger.Type = DTCore.LogType.ALL;
            process.Loger.Handlers.Add(new Beetle.DTCore.ConsoleLogHandler());
            process.Loger.Process(DTCore.LogType.INFO, "start args {0}", string.Join(",", args));
            process.Open();
            //process.Run(casename, 10, "{Url:\"http://www.baidu.com\"}");
            while (true)
            {
                System.Threading.Thread.Sleep(999);
                if (process.CurrentTest != null)
                {
                    string value = Newtonsoft.Json.JsonConvert.SerializeObject(process.CurrentTest.StatisticalInfo);
                }
                Console.WriteLine();
            }
            Console.Read();
        }
Example #7
0
        public void InvalidDelay()
        {
            TestProcess p = new TestProcess(_sim, 10);

            p.DelayTime = -1L;
            _sim.Run(new Task [] { p });
        }
        public void TestAliveWhenStarted()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Assert.
            Assert.IsFalse(process.Dead);
        }
Example #9
0
        public void TestAliveWhenStarted()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Assert.
            Assert.IsFalse(process.Dead);
        }
Example #10
0
        public void CountToTen()
        {
            TestProcess p = new TestProcess(_sim, 10);

            _sim.Run(new Task [] { p });
            Assert.AreEqual(10, p.CurrentIteration);
            Assert.AreEqual(100L, _sim.Now);
        }
Example #11
0
        public void TestNotPausedWhenStarted()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Assert.
            Assert.IsFalse(process.Paused);
        }
Example #12
0
        public void TestUninitializedBeforeStarted()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Assert.
            Assert.IsFalse(process.Initialized);
        }
Example #13
0
        protected override void Given()
        {
            _runner = TestProcess.CreateProcessRunner()
                      .WithArguments(args =>
                                     args
                                     .AddOption("--stdout", "EXPECTED STDOUT")
                                     .AddOption("--stderr", "EXPECTED STDERR"));

            _writer = new StringWriter();
        }
Example #14
0
        public void TestInitializedWhenStarted()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Act.
            this.game.ProcessManager.AddProcess(process);

            // Assert.
            Assert.IsTrue(process.Initialized);
        }
Example #15
0
        public void Given_OtherProcess_Ref_ShouldReturnIt()
        {
            var id = Guid.NewGuid().ToString();
            var p  = new TestProcess();

            var(pid, ok) = ProcessRegistry.Instance.TryAdd(id, p);

            var p2 = pid.Ref;

            Assert.Same(p, p2);
        }
        public void TestDeadAfterKilled()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Act.
            process.Kill();

            // Assert.
            Assert.IsTrue(process.Dead);
        }
        public void Given_PIDDoesNotExist_TryAddShouldAddLocalPID()
        {
            var id  = Guid.NewGuid().ToString();
            var p   = new TestProcess();
            var reg = new ProcessRegistry();

            var(pid, ok) = reg.TryAdd(id, p);

            Assert.True(ok);
            Assert.Equal(reg.Address, pid.Address);
        }
Example #18
0
        public void TestDeadAfterKilled()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Act.
            process.Kill();

            // Assert.
            Assert.IsTrue(process.Dead);
        }
        public void Given_PIDExistsInHostResolver_GetShouldReturnIt()
        {
            var pid = new PID();
            var p   = new TestProcess();
            var reg = new ProcessRegistry();

            reg.RegisterHostResolver(x => p);

            var p2 = reg.Get(pid);

            Assert.Same(p, p2);
        }
        public void Given_PIDExists_TryAddShouldNotAddLocalPID()
        {
            var id  = Guid.NewGuid().ToString();
            var p   = new TestProcess();
            var reg = new ProcessRegistry();

            reg.TryAdd(id, p);

            var(_, ok) = reg.TryAdd(id, p);

            Assert.False(ok);
        }
        public void Given_PIDExists_GetShouldReturnIt()
        {
            var id  = Guid.NewGuid().ToString();
            var p   = new TestProcess();
            var reg = new ProcessRegistry();

            reg.TryAdd(id, p);
            var(pid, _) = reg.TryAdd(id, p);

            var p2 = reg.Get(pid);

            Assert.Same(p, p2);
        }
        public void Given_PIDWasRemoved_GetShouldReturnDeadLetterProcess()
        {
            var id  = Guid.NewGuid().ToString();
            var p   = new TestProcess();
            var reg = new ProcessRegistry();

            var(pid, _) = reg.TryAdd(id, p);
            reg.Remove(pid);

            var p2 = reg.Get(pid);

            Assert.Same(DeadLetterProcess.Instance, p2);
        }
Example #23
0
        public void TestProcessThen()
        {
            // Arrange.
            TestProcess first  = new TestProcess();
            TestProcess second = new TestProcess();
            TestProcess third  = new TestProcess();

            // Act.
            first.Then(second).Then(third);

            // Assert.
            Assert.AreEqual(second, first.Next);
            Assert.AreEqual(third, second.Next);
        }
Example #24
0
        public void InnerJoinWithDefaultLeftJoin()
        {
            var items = new List <Row>();

            var result = new TestProcess(
                new GenericEnumerableOperation(left),
                new InnerJoinUsersToPeopleByEmail().Right(new GenericEnumerableOperation(right)),
                new ResultsOperation(items)
                );

            result.Execute();

            Assert.Single(items);
            Assert.Equal(3, items[0]["person_id"]);
        }
        public void InnerJoinWithDefaultLeftJoin()
        {
            var items = new List<Row>();

            var result = new TestProcess(
                new GenericEnumerableOperation(left),
                new InnerJoinUsersToPeopleByEmail().Right(new GenericEnumerableOperation(right)),
                new ResultsOperation(items)
                );

            result.Execute();

            Assert.Equal(1, items.Count);
            Assert.Equal(3, items[0]["person_id"]);
        }
        public void TestDontStartNextProcessWhileAlive()
        {
            // Arrange.
            TestProcess first = new TestProcess();
            TestProcess second = new TestProcess();
            first.Next = second;

            // Act.
            this.game.ProcessManager.AddProcess(first);
            this.game.Update(1.0f);

            // Assert.
            Assert.IsTrue(first.Active);
            Assert.IsFalse(second.Active);
        }
Example #27
0
        public void TestDontStartNextProcessWhileAlive()
        {
            // Arrange.
            TestProcess first  = new TestProcess();
            TestProcess second = new TestProcess();

            first.Next = second;

            // Act.
            this.game.ProcessManager.AddProcess(first);
            this.game.Update(1.0f);

            // Assert.
            Assert.IsTrue(first.Active);
            Assert.IsFalse(second.Active);
        }
Example #28
0
        public void TestTogglePause()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Act.
            process.TogglePause();

            // Assert.
            Assert.IsTrue(process.Paused);

            // Act.
            process.TogglePause();

            // Assert.
            Assert.IsFalse(process.Paused);
        }
Example #29
0
        public void LeftJoinWithDefaultLeftJoin()
        {
            var items = new List <Row>();

            var result = new TestProcess(
                new GenericEnumerableOperation(left),
                new LeftJoinUsersToPeopleByEmail().Right(new GenericEnumerableOperation(right)),
                new ResultsOperation(items)
                );

            result.Execute();

            Assert.Equal(2, items.Count);
            Assert.Equal(3, items[0]["person_id"]);
            Assert.Null(items[1]["person_id"]);
            Assert.Equal("bar", items[1]["name"]);
        }
        public void TestInitializedWhenStarted()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Act.
            this.game.ProcessManager.AddProcess(process);

            // Assert.
            Assert.IsTrue(process.Initialized);
        }
        public void TestTogglePause()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Act.
            process.TogglePause();

            // Assert.
            Assert.IsTrue(process.Paused);

            // Act.
            process.TogglePause();

            // Assert.
            Assert.IsFalse(process.Paused);
        }
        public void TestProcessThen()
        {
            // Arrange.
            TestProcess first = new TestProcess();
            TestProcess second = new TestProcess();
            TestProcess third = new TestProcess();

            // Act.
            first.Then(second).Then(third);

            // Assert.
            Assert.AreEqual(second, first.Next);
            Assert.AreEqual(third, second.Next);
        }
Example #33
0
 protected override void Given()
 {
     _runner = TestProcess.CreateProcessRunner();
 }
        public void TestUninitializedBeforeStarted()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Assert.
            Assert.IsFalse(process.Initialized);
        }
 public ILauncherProcess CreateProcess(ProcessStartInfo info)
 {
     Process = new TestProcess(info);
     return(Process);
 }
Example #36
0
        public void Constructor_ValidProject()
        {
            TestProcess process = new TestProcess(DummyProject);

            process.WaitForExit();
        }
        public void TestNotPausedWhenStarted()
        {
            // Arrange.
            TestProcess process = new TestProcess();

            // Assert.
            Assert.IsFalse(process.Paused);
        }
Example #38
0
 protected override void Given()
 {
     _runner = TestProcess.CreateProcessRunner()
               .WithArguments(args => args.AddOption("--exit-code", "4"));
 }
Example #39
0
        private void Start(IDevice device, bool primaryVerification, CancellationToken cancellation)
        {
            try
            {
                Exception = null;
                ReadPsysInfo();
                DeviceSpecification.CheckRangeSupport(device);
                UpdProductInfoEvent?.Invoke(this, new EventArgs());

                Action <CancellationToken> waitContinueAction = null;
                waitContinue = null;

                ITestProcess     testProcess;
                IMeasurmentTools measurmentTools;
                if (!Settings.UsedAutomaticSortingOut)
                {
                    waitContinue = new WaitContinue();
                    waitContinue.ContinueRequest  += ContinueRequest;
                    waitContinue.SelectionRequest += (obj, e) => SelectionRequest(this, e);
                    waitContinueAction             = waitContinue.Wait;
                }
                if (device.OutPort == OutPortEnum.Current)
                {
                    InitAmmetr();
                    ammetr.StartCycleMeasureCurrent();
                    measurmendIndicator = new MeasurmendIndicator(ammetr, psys, device.Range.RangeType == RangeTypeEnum.DA);
                    measurmentTools     = new CurrentMeasurmentTools(psys, GetPsysOutChannel(), ammetr);
                }
                else
                {
                    // Для симуляции преобразователя давления с цифровым портом
                    var digitalDevice = new DigitalPdSimulator(psys, device.Range.Min_Pa, device.Range.Max_Pa, 0.05,
                                                               device.Range.RangeType == RangeTypeEnum.DA);

                    // var digitalDevice = new PD_RS_device("COM5");

                    // Индикатор давления
                    measurmendIndicator = new MeasurmendIndicator(psys, device.Range.RangeType == RangeTypeEnum.DA);
                    measurmentTools     = new DigitalMeasurmentTools(psys, GetPsysOutChannel(), digitalDevice);
                }
                testProcess = new TestProcess(waitContinueAction, measurmentTools, GetTestPoints(device.Range.Max_Pa, device.Range.Min_Pa),
                                              Settings.TestPause100);
                measurmendIndicator.UpdDataEvent += UpdateMeasurmendIndicators;
                measurmendIndicator.Start();
                testProcess.UpdResultsEvent += UpdTestResult_event;
                progress.Report(0);
                double precision = primaryVerification ? device.TargetPrecision : device.Precision;
                var    units     = (PressureSensorTestCore.PressureUnitsEnum)device.Range.PressureUnits;
                testProcess.RunProcess(device.Range.Min_Pa, device.Range.Max_Pa, units, precision, device.Range.RangeType == RangeTypeEnum.DA,
                                       cancellation, progress);
                Product.Error = (TestErrorEnum)TestResults.GetResume();
                waitContinue?.WaitSelection(cancellation);
                Stop();
            }
            catch (OperationCanceledException)
            {
                Product.Error = TestErrorEnum.InDefined;
                Stop();
                if (Exception != null)
                {
                    processErrorHandler.ErrorHanding(Exception, Product);
                }
                else
                {
                    throw;
                }
            }
            catch (Exception ex)
            {
                Product.Error = TestErrorEnum.InDefined;
                Stop();
                Exception = ex;
                processErrorHandler.ErrorHanding(ex, Product);
            }
        }