Ejemplo n.º 1
0
            public static void Run(string name)
            {
                ActiveTest aTest = manager.activeTests[name];

                if (string.IsNullOrEmpty(name))
                {
                    throw new ArgumentNullException("name", "A unique Test name must be provided.");
                }
                if (!manager.activeTests.ContainsKey(name))
                {
                    throw new InvalidOperationException("An ActiveTest must first be loaded.");
                }
                if (!aTest.IsInState(aTest.m_StateLoaded))
                {
                    throw new InvalidOperationException("The Test cannot be ran. It has not been successfully loaded.");
                }

                if (aTest.IsInState(aTest.m_StateLoaded))
                {
                    qf4net.QF.Instance.Publish(new TestEvent(QFSignal.TestRun, name));
                    while ((!aTest.IsInState(aTest.m_StateEnded)) && (!aTest.IsInState(aTest.m_StateRunning)))
                    {
                        System.Threading.Thread.Sleep(1);
                    }
                }
            }
Ejemplo n.º 2
0
            public static void Abort(string name, string reason)
            {
                if (string.IsNullOrEmpty(name))
                {
                    throw new ArgumentNullException("name", "A unique Test name must be provided.");
                }
                if (string.IsNullOrEmpty(reason))
                {
                    throw new ArgumentNullException("reason", "An abort reason must be provided.");
                }
                if (!manager.activeTests.ContainsKey(name))
                {
                    throw new InvalidOperationException("An ActiveTest must first be loaded.");
                }

                qf4net.QF.Instance.Publish(new TestEvent(QFSignal.TestAbort, name, reason));

                ActiveTest aTest = manager.activeTests[name];

                while (!aTest.IsInState(aTest.m_StateEnded))
                {
                    System.Threading.Thread.Sleep(1);
                }

                manager.activeTests[name].Dispose();
                manager.activeTests.Remove(name);
            }
Ejemplo n.º 3
0
            public static void Load(DataLayer.Test test, UUTTestMode mode)
#endif
            {
                if (test == null)
                {
                    throw new ArgumentNullException("test", "A valid Test must be provided.");
                }
                if ((string.IsNullOrEmpty(test.Name) || manager.activeTests.ContainsKey(test.Name)))
                {
                    throw new ArgumentNullException("Test.Name", "An ActiveTest must have a unique name.");
                }

#if UUT_TEST == false
                manager.activeTests.Add(test.Name, new ActiveTest(test));
#else
                manager.activeTests.Add(test.Name, new ActiveTest(test, mode));
#endif
                manager.activeTests[test.Name].Start(manager.priority++);

                ActiveTest aTest = manager.activeTests[test.Name];
                while ((!aTest.IsInState(aTest.m_StateEnded)) && (!aTest.IsInState(aTest.m_StateLoaded)))
                {
                    System.Threading.Thread.Sleep(1);
                }
            }
Ejemplo n.º 4
0
            public static void End(string name)
            {
                if (string.IsNullOrEmpty(name))
                {
                    throw new ArgumentNullException("name", "A unique Test name must be provided.");
                }
                if (!manager.activeTests.ContainsKey(name))
                {
                    throw new InvalidOperationException("An ActiveTest must first be loaded.");
                }

                ActiveTest aTest = manager.activeTests[name];

                if (!aTest.IsInState(aTest.m_StateEnded))
                {
                    throw new InvalidOperationException("ActiveTest cannot be ended. It is not in the ended state. Use Abort instead.");
                }

                manager.activeTests[name].Dispose();
                manager.activeTests.Remove(name);
            }