コード例 #1
0
ファイル: Program.cs プロジェクト: andreasling/linxUnit
        static void Main(string[] args)
        {
            if (args.Length > 0)
            {
                RunHelper.StartTimedTestRun(suite =>
                {
                    var loader = new TestLoader();

                    foreach (var arg in args)
                    {
                        Debug.WriteLine(arg);

                        if (Directory.Exists(arg))
                        {
                            suite.Add(loader.LoadFromDirectory(arg));
                        }
                        else if (File.Exists(arg))
                        {
                            suite.Add(loader.LoadFromFile(arg));
                        }
                    }
                });
            }
            else
            {
                Console.WriteLine("No arguments.");
            }
        }
コード例 #2
0
        public void SetUp()
        {
            NUnitRegistry.TestMode = true;
            NUnitRegistry.ClearTestKeys();

            loader  = new TestLoader(Console.Out, Console.Error);
            catcher = new TestEventCatcher(loader.Events);
        }
コード例 #3
0
        private static IEnumerable <AbiTest> LoadBasicAbiTests()
        {
            IEnumerable <AbiTest> tests = TestLoader.LoadFromFile <Dictionary <string, AbiTestJson>, AbiTest>(
                "basic_abi_tests.json",
                allTests => allTests.Select(namedTest => Convert(namedTest.Key, namedTest.Value)));

            return(tests);
        }
コード例 #4
0
        private static IEnumerable <TrieTest> LoadAnyOrderTests()
        {
            IEnumerable <TrieTest> tests = TestLoader.LoadFromFile <Dictionary <string, TrieTestJson>, TrieTest>(
                "trieanyorder.json",
                dwj => dwj.Select(p => new TrieTest(p.Key, p.Value.In.ToList(), p.Value.Root)));

            return(GetTestPermutations(tests));
        }
コード例 #5
0
 public void TestDelayedLoad()
 {
     AddStep("begin loading", () => LoadScreen(loader = new TestLoader()));
     AddUntilStep("wait for logo visible", () => loader.Logo?.Alpha > 0);
     AddStep("finish loading", () => loader.AllowLoad.Set());
     AddUntilStep("loaded", () => loader.Logo != null && loader.ScreenLoaded);
     AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0);
 }
コード例 #6
0
		public override void ApplySettings()
		{
			TestLoader loader = Services.TestLoader;

			settings.SaveSetting( "Options.TestLoader.ReloadOnChange", loader.ReloadOnChange = reloadOnChangeCheckBox.Checked );
			settings.SaveSetting( "Options.TestLoader.RerunOnChange", loader.RerunOnChange = rerunOnChangeCheckBox.Checked );
			settings.SaveSetting( "Options.TestLoader.ReloadOnRun", loader.ReloadOnRun = reloadOnRunCheckBox.Checked );
		}
コード例 #7
0
        private static IEnumerable <TrieTest> LoadHexEncodedSecureTests()
        {
            IEnumerable <TrieTest> tests = TestLoader.LoadFromFile <Dictionary <string, TrieTestJson>, TrieTest>(
                "hex_encoded_securetrie_test.json",
                dwj => dwj.Select(p => new TrieTest(p.Key, p.Value.In.ToList(), p.Value.Root)));

            return(GetTestPermutations(tests));
        }
コード例 #8
0
ファイル: TestTree.cs プロジェクト: xinqinglhj/AutoTest.Net
 public void Initialize(TestLoader loader)
 {
     this.tests.Initialize(loader, loader.Events);
     this.loader = loader;
     loader.Events.TestLoaded   += new NUnit.Util.TestEventHandler(events_TestLoaded);
     loader.Events.TestReloaded += new NUnit.Util.TestEventHandler(events_TestReloaded);
     loader.Events.TestUnloaded += new NUnit.Util.TestEventHandler(events_TestUnloaded);
 }
コード例 #9
0
        public override void ApplySettings()
        {
            TestLoader loader = Services.TestLoader;

            settings.SaveSetting("Options.TestLoader.MultiDomain", loader.MultiDomain                 = multiDomainRadioButton.Checked);
            settings.SaveSetting("Options.TestLoader.MergeAssemblies", loader.MergeAssemblies         = mergeAssembliesCheckBox.Checked);
            settings.SaveSetting("Options.TestLoader.AutoNamespaceSuites", loader.AutoNamespaceSuites = autoNamespaceSuites.Checked);
        }
コード例 #10
0
        public void SetUp()
        {
            loader = new TestLoader( );
            loader.MergeAssemblies     = false;
            loader.AutoNamespaceSuites = true;
            loader.MultiDomain         = false;

            catcher = new TestEventCatcher(loader.Events);
        }
コード例 #11
0
 public void TestDelayedLoad()
 {
     AddStep("begin loading", () => LoadScreen(loader = new TestLoader()));
     AddUntilStep("wait for spinner visible", () => loader.LoadingSpinner?.Alpha > 0);
     AddStep("finish loading", () => loader.AllowLoad.Set());
     AddUntilStep("spinner gone", () => loader.LoadingSpinner?.Alpha == 0);
     AddUntilStep("loaded", () => loader.ScreenLoaded);
     AddUntilStep("not current", () => !loader.IsCurrentScreen());
 }
コード例 #12
0
        public void CanLoadSuiteFromAssembly()
        {
            Assembly thisAssembly = Assembly.GetExecutingAssembly();
            ITest    suite        = TestLoader.Load(thisAssembly);

            Assert.That(suite.TestCaseCount, Is.GreaterThan(100));
            Assert.That(suite.Name, Is.EqualTo(thisAssembly.GetName().Name));

            // Don't run! It would recurse infinitely on this test.
        }
コード例 #13
0
        public void Add(Assembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            // TestLoader.Load always return a TestSuite so we can avoid casting many times
            suites.Add(TestLoader.Load(assembly) as TestSuite);
        }
コード例 #14
0
ファイル: TestsBase.cs プロジェクト: angelinai/nethermind
        public static IEnumerable <DifficultyTests> LoadHex(string fileName)
        {
            Stopwatch watch = new Stopwatch();
            IEnumerable <DifficultyTests> tests = TestLoader.LoadFromFile <Dictionary <string, DifficultyTestHexJson>, DifficultyTests>(
                fileName,
                t => t.Select(dtj => ToTest(fileName, dtj.Key, dtj.Value))).ToList();

            watch.Stop();
            return(tests);
        }
コード例 #15
0
 public TestManipulator(UnswerManipalatorI unswerManipalator,
                        GoTestQueryConfiguratorI goTestQueryConfigurator,
                        QuestionManipulatorI questionManipulator)
 {
     testloader = new TestLoader(unswerManipalator,
                                 goTestQueryConfigurator, questionManipulator);
     testUpdater = new TestUpdater(unswerManipalator,
                                   goTestQueryConfigurator, questionManipulator);
     testCreator = new TestCreator(unswerManipalator,
                                   goTestQueryConfigurator, questionManipulator);
 }
コード例 #16
0
        public void CanLoadAndRunSuiteFromSuiteProperty()
        {
            ITest suite = TestLoader.LoadAsSuite(typeof(MyTests));

            Assert.That(suite, Is.Not.Null, "Could not get suite");
            Assert.That(suite.TestCaseCount, Is.EqualTo(4));
            RecordingTestListener listener = new RecordingTestListener();

            suite.Run(listener);
            Assert.That(listener.Events, Is.EqualTo(
                            "<MyTests:<One::Success><Two::Success><TheTest::Failure><Three::Success>:Failure>"));
        }
コード例 #17
0
        public void TestInstantLoad()
        {
            // visual only, very impossible to test this using asserts.

            AddStep("load immediately", () =>
            {
                loader = new TestLoader();
                loader.AllowLoad.Set();

                LoadScreen(loader);
            });
        }
コード例 #18
0
        public void TestReadPerformenceComparison()
        {
            DaabRead();
            DbHelperRead();
            GatewayRead();

            Console.WriteLine(string.Format("Daab read (Single Thread):\t\t{0}", TestLoader.GetSingleThreadSpend(REPEAT_TIME, new TestHandler1(DaabRead))));
            Console.WriteLine(string.Format("DbHelper read (Single Thread):\t{0}", TestLoader.GetSingleThreadSpend(REPEAT_TIME, new TestHandler1(DbHelperRead))));
            Console.WriteLine(string.Format("Gateway read (Single Thread):\t{0}", TestLoader.GetSingleThreadSpend(REPEAT_TIME, new TestHandler1(GatewayRead))));
            Console.WriteLine(string.Format("Daab read (Multi Thread):\t\t{0}", TestLoader.GetMultiThreadSpend(REPEAT_TIME, new TestHandler1(DaabRead))));
            Console.WriteLine(string.Format("DbHelper read (Multi Thread):\t\t{0}", TestLoader.GetMultiThreadSpend(REPEAT_TIME, new TestHandler1(DbHelperRead))));
            Console.WriteLine(string.Format("Gateway read (Multi Thread):\t\t{0}", TestLoader.GetMultiThreadSpend(REPEAT_TIME, new TestHandler1(GatewayRead))));
        }
コード例 #19
0
        public void testLoadFromFileAbsolute()
        {
            // Arrange
            TestSuite suite = null;
            TestLoader loader = new TestLoader();
            string file = System.IO.Path.GetFullPath(@"..\..\..\TestLoaderTestTests\bin\Debug\TestLoaderTestTests.dll");

            // Act
            suite = loader.LoadFromFile(file);

            // Assert
            Assert.AreEqual(1, suite.Tests.Count);
        }
コード例 #20
0
        public void testLoadFromDirectoryRelative()
        {
            // Arrange
            TestSuite suite = null;
            TestLoader loader = new TestLoader();
            string directory = @"..\..\..\TestLoaderTestTests\bin\Debug\";

            // Act
            suite = loader.LoadFromDirectory(directory);

            // Assert
            Assert.AreEqual(1, suite.Tests.Count);
        }
コード例 #21
0
        public void testLoadFromDirectoryAbsolute()
        {
            // Arrange
            TestSuite suite = null;
            TestLoader loader = new TestLoader();
            string directory = System.IO.Path.GetFullPath(@"..\..\..\TestLoaderTestTests\bin\Debug\");

            // Act
            suite = loader.LoadFromDirectory(directory);

            // Assert
            Assert.AreEqual(1, suite.Tests.Count);
        }
コード例 #22
0
        public static void Init(Form ownerForm, TextWriter outWriter, TextWriter errWriter)
        {
            AppUI.outWriter = outWriter;
            Console.SetOut(outWriter);

            AppUI.errWriter = errWriter;
            Console.SetError(errWriter);

            loader                = new TestLoader(outWriter, errWriter);
            loader.ReloadOnRun    = UserSettings.Options.ReloadOnRun;
            loader.ReloadOnChange = UserSettings.Options.ReloadOnChange;
            loaderUI              = new TestLoaderUI(ownerForm, loader);
        }
コード例 #23
0
ファイル: AssemblyLoadTests.cs プロジェクト: wsgan001/asegrp
        public void Load1000TestsUsingTestLoader()
        {
            loader = new TestLoader();
            int start = Environment.TickCount;

            loader.LoadProject("loadtest-assembly.dll");
            Assert.IsTrue(loader.IsProjectLoaded);
            loader.LoadTest();
            Assert.IsTrue(loader.IsTestLoaded);
            Assert.AreEqual(1000, loader.TestCount);
            int ms = Environment.TickCount - start;

            Assert.LessOrEqual(ms, 4000);
        }
コード例 #24
0
ファイル: RecogAutomator.cs プロジェクト: ondister/Recog
        private void OpenForm()
        {
            TestLoader tlk = new TestLoader(_fe);

            tlk.SetHumanID();
            _humanid = tlk.HumanID;
            if (_humanid != 0)
            {
                _recogform                      = new RForm((int)_test, _humanid, _ge, _fe);
                _recogform.WindowState          = FormWindowState.Maximized;
                _recogform.btn_addtobase.Click += new EventHandler(btn_addtobase_Click);
                _recogform.Show();
            }
        }
コード例 #25
0
        public static void SaveProject(Form owner)
        {
            TestLoader loader = Services.TestLoader;

            if (Path.IsPathRooted(loader.TestProject.ProjectPath) &&
                NUnitProject.IsNUnitProjectFile(loader.TestProject.ProjectPath) &&
                CanWriteProjectFile(loader.TestProject.ProjectPath))
            {
                loader.TestProject.Save();
            }
            else
            {
                SaveProjectAs(owner);
            }
        }
コード例 #26
0
        public void OnlyComplete5MinDataIsReported()
        {
            var undertest = new TestLoader();
            var date = new DateTime(2014, 05, 14);
            undertest.Minute_Log_5s = new[]{
                new Minute_Log_5 { ApplianceID = 1, LogDate = date, Usage_00 = -1,   Usage_05 = -1 },
                new Minute_Log_5 { ApplianceID = 2, LogDate = date, Usage_00 = null, Usage_05 = -2, Usage_10 = -2 },
            };

            var result = undertest.Get5minPlugwiseYield(date, new[] { 1, 2 } /*specific appliances*/);
            // We expect a single result using just Usage_05 since that is complete.
            var expected = new[] {
                new YieldAggregate(date.AddMinutes(5),3, TimeSpan.FromMinutes(5))
            };
            CollectionAssert.AreEquivalent(expected, result);
        }
コード例 #27
0
        public void TestLongLoad()
        {
            bool logoVisible = false;

            AddStep("begin loading", () => LoadScreen(loader = new TestLoader()));
            AddWaitStep("wait", 10);
            AddStep("finish loading", () =>
            {
                logoVisible = loader.Logo?.Alpha > 0;
                loader.AllowLoad.Set();
            });

            AddAssert("loaded", () => loader.Logo != null && loader.ScreenLoaded);
            AddAssert("logo was visible", () => logoVisible);
            AddUntilStep("logo gone", () => loader.Logo?.Alpha == 0);
        }
コード例 #28
0
    // Start is called before the first frame update
    void Start()
    {
        Sessions = Database.GetSessions();
        Loader   = new TestLoader();

        for (int i = 0; i < Sessions.Count; i++)
        {
            var button = Instantiate(Button, Panel);

            var text = button.GetComponentInChildren <Text>();
            text.text = Sessions[i] + "";
            int index = i;

            button.onClick.AddListener(() => Choose(Sessions[index]));
        }
    }
コード例 #29
0
        public void TestInstantLoad()
        {
            AddStep("load immediately", () =>
            {
                loader = new TestLoader();
                loader.AllowLoad.Set();

                LoadScreen(loader);
            });

            spinnerNotPresentOrHidden();

            AddUntilStep("loaded", () => loader.ScreenLoaded);
            AddUntilStep("not current", () => !loader.IsCurrentScreen());

            spinnerNotPresentOrHidden();
        }
コード例 #30
0
        public void InComplete5MinDataIsReported()
        {
            var undertest = new TestLoader();
            var date = new DateTime(2014, 05, 14);
            undertest.Minute_Log_5s = new[]{
                new Minute_Log_5 { ApplianceID = 1, LogDate = date, Usage_00 = -1,   Usage_05 = -1 },
                new Minute_Log_5 { ApplianceID = 2, LogDate = date, Usage_00 = null, Usage_05 = -2, Usage_10 = -2 },
            };

            var result = undertest.Get5minPlugwiseYield(date, new int[0] /*No specific appliances*/);
            var expected = new[] {
                new YieldAggregate (date.AddMinutes(00), 1, TimeSpan.FromMinutes(5)) ,
                new YieldAggregate (date.AddMinutes(05), 3, TimeSpan.FromMinutes(5)) ,
                new YieldAggregate (date.AddMinutes(10), 2, TimeSpan.FromMinutes(5))
            };
            CollectionAssert.AreEquivalent(expected, result);
        }
コード例 #31
0
        public void Add(Assembly assembly)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException("assembly");
            }

            // this can be called many times but we only want to load them
            // once since we need to share them across most activities
            if (!Initialized)
            {
                // TestLoader.Load always return a TestSuite so we can avoid casting many times
                TestSuite ts = TestLoader.Load(assembly) as TestSuite;
                AndroidRunner.AssemblyLevel.Add(ts);
                Add(ts);
            }
        }
コード例 #32
0
ファイル: TestGui.cs プロジェクト: atteneder/glTFastDemo
    void Awake()
    {
        testLoader        = GetComponent <TestLoader>();
        stopWatchGui.posX = GlobalGui.listWidth;

#if PLATFORM_WEBGL && !UNITY_EDITOR
        // Hide UI in glTF compare web
        showMenu = false;
#endif

        var selectSet = GetComponent <SampleSetSelectGui>();
        selectSet.onSampleSetSelected += OnSampleSetSelected;

        testLoader.urlChanged   += UrlChanged;
        testLoader.loadingBegin += OnLoadingBegin;
        testLoader.loadingEnd   += OnLoadingEnd;
    }
コード例 #33
0
        public void TestInstantLoad()
        {
            // visual only, very impossible to test this using asserts.

            AddStep("load immediately", () =>
            {
                loader = new TestLoader();
                loader.AllowLoad.Set();

                LoadScreen(loader);
            });

            AddAssert("spinner did not display", () => loader.LoadingSpinner?.Alpha == 0);

            AddUntilStep("loaded", () => loader.ScreenLoaded);
            AddUntilStep("not current", () => !loader.IsCurrentScreen());
        }
コード例 #34
0
        public static void NewProject(Form owner)
        {
            TestLoader     loader = Services.TestLoader;
            SaveFileDialog dlg    = new SaveFileDialog();

            dlg.Title           = "New Test Project";
            dlg.Filter          = "NUnit Test Project (*.nunit)|*.nunit|All Files (*.*)|*.*";
            dlg.FileName        = Services.ProjectService.GenerateProjectName();
            dlg.DefaultExt      = "nunit";
            dlg.ValidateNames   = true;
            dlg.OverwritePrompt = true;

            if (dlg.ShowDialog(owner) == DialogResult.OK)
            {
                loader.NewProject(dlg.FileName);
            }
        }
コード例 #35
0
        /// <summary>
        ///     Overrides <see cref="TestExtractor.Extractor.Extractor.Extractor.Extract()" />
        /// </summary>
        protected override void Extract()
        {
            var assemblies = AppDomain.CurrentDomain.GetData(AppDataDomainExtractionAssemblyName) as IList <string>;

            if (assemblies == null || !assemblies.Any())
            {
                return;
            }

            TestSuites  = new List <ISuiteNode>();
            TestMethods = new List <IStubNode>();

            ServiceManager.Services.AddService(new SettingsService());
            ServiceManager.Services.AddService(new DomainManager());
            ServiceManager.Services.AddService(new ProjectService());
            ServiceManager.Services.AddService(new AddinRegistry());
            ServiceManager.Services.AddService(new AddinManager());
            ServiceManager.Services.AddService(new TestAgency());
            ServiceManager.Services.InitializeServices();

            foreach (var assembly in assemblies.Distinct().Where(File.Exists))
            {
                _assembly = assembly;

                var loader = new TestLoader();
                loader.Events.TestLoaded += NodeLoadEvent;
                loader.LoadProject(assembly);
                loader.LoadTest();

                loader.UnloadTest();
                loader.UnloadProject();
                loader.Events.TestLoaded -= NodeLoadEvent;

                _assembly = string.Empty;
            }

            var tests      = TestMethods.ToList();
            var testSuites = TestSuites.ToList();

            AppDomain.CurrentDomain.SetData(AppDataDomainExtractionStubName, tests);
            AppDomain.CurrentDomain.SetData(AppDataDomainExtractionSuiteName, testSuites);

            ServiceManager.Services.StopAllServices();
            ServiceManager.Services.ClearServices();
        }
コード例 #36
0
        //
        // This method is invoked when the application has loaded and is ready to run. In this
        // method you should instantiate the window, load the UI into it and then make the window
        // visible.
        //
        // You have 17 seconds to return from this method, or iOS will terminate your application.
        //
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            // create a new window instance based on the screen size
            window        = new UIWindow(UIScreen.MainScreen.Bounds);
            runner        = new TouchRunner(window);
            runner.Filter = new NotFilter(new CategoryExpression("MobileNotWorking,NotOnMac,NotWorking,ValueAdd,CAS,InetAccess,NotWorkingLinqInterpreter").Filter);

            // register every tests included in the main application/assembly
            runner.Add(System.Reflection.Assembly.GetExecutingAssembly());
            TestLoader.AddTestAssemblies(runner);

            window.RootViewController = new UINavigationController(runner.GetViewController());

            // make the window visible
            window.MakeKeyAndVisible();

            return(true);
        }
コード例 #37
0
        public void testLoadFromDirectoryFail()
        {
            // Arrange
            TestSuite suite = null;
            TestLoader loader = new TestLoader();
            string directory = "x";

            try
            {
                // Act
                suite = loader.LoadFromDirectory(directory);

                Assert.Fail();
            }
            catch (ArgumentException actual)
            {
                // Assert
                Assert.AreEqual("Directory does not exist\r\nParameter name: directory", actual.Message);
            }
        }
コード例 #38
0
        public void SetUp()
        {
            loader = new TestLoader( );
            loader.MergeAssemblies = false;
            loader.AutoNamespaceSuites = true;
            loader.MultiDomain = false;

            catcher = new TestEventCatcher( loader.Events );
        }
コード例 #39
0
		public void SetUp()
		{
			loader = new TestLoader( );
			catcher = new TestEventCatcher( loader.Events );
		}
コード例 #40
0
        public void testLoadFromFileFail()
        {
            // Arrange
            TestSuite suite = null;
            TestLoader loader = new TestLoader();
            string file = "x";

            try
            {
                // Act
                suite = loader.LoadFromFile(file);

                Assert.Fail();
            }
            catch (ArgumentException actual)
            {
                // Assert
                Assert.AreEqual("File does not exist\r\nParameter name: file", actual.Message);
            }
        }
コード例 #41
0
        public void testLoadFromFileRelative()
        {
            // Arrange
            TestSuite suite = null;
            TestLoader loader = new TestLoader();
            string file = @"..\..\..\TestLoaderTestTests\bin\Debug\TestLoaderTestTests.dll";

            // Act
            suite = loader.LoadFromFile(file);

            // Assert
            Assert.AreEqual(1, suite.Tests.Count);
        }