public static void Main(string[] args) { var parser = new Parser(config => config.HelpWriter = Console.Out); var options = parser.ParseArguments <Options>(args).Value; if (options.NumberOfTimes <= 0) { Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("You must specify a positive number of times for execution"); Console.ResetColor(); Environment.Exit(0); } ITest test = null; if (options.BasicTest) { test = new BasicTest(options.NumberOfTimes); } if (options.MultiThread) { Configuration.BenchmarkTableFactory = new BenchmarkMultiTableFactory(); } if (test == null) { Console.WriteLine("You must specify one type of test at least"); } else { test.Execute(); test.PrintResults(); } }
static void RunBasicTest() { using (Runner runner = RunnerFactory.Instance.Create(DevToken)) { // Create test var test = new BasicTest(); // Run test runner.Run(test); } }
public void RunBasicTest1() { var s = new BasicTest() { I = 1, S = "2", Ignored = "3", ShallowObj = new object() }; var c = cloner.Clone(s); Assert(s != c); Assert(s.CS == c.CS); Assert(c.Ignored == null); Assert(ReferenceEquals(s.ShallowObj, c.ShallowObj)); }
protected void RunTest(Runner runner) { var test = new BasicTest { name = "John Smith", password = "******", country = "United States", address = "5000 Highway 7 East", email = "*****@*****.**", phone = "+1 (905) 515-2000" }; // Run action runner.Run(test); }
static void Main(string[] args) { // 当 Code First 与数据库结构不一致时 // 自动升级到最新的版本. Database.SetInitializer(new MigrateDatabaseToLatestVersion <B2000_AbpEfDbContext, B2000_AbpEf.Migrations.Configuration>()); Console.WriteLine("========== Basic =========="); // 单表基本操作. BasicTest.TestOneTableFunc(); // 多表基本操作. BasicTest.TestMulTableFunc(); // 翻页的操作. BasicTest.TestPage(); // 直接执行 SQL 语句的操作. BasicTest.ExecSql(); // 使用 ABP 框架的测试操作. Console.WriteLine("========== ABP =========="); //Bootstrapping ABP system using (var bootstrapper = AbpBootstrapper.Create <B2000_AbpEfAbpModule>()) { bootstrapper.Initialize(); using (var tester = bootstrapper.IocManager.ResolveAsDisposable <AbpTest>()) { tester.Object.TestOneTableFunc(); tester.Object.TestMulTableFunc(); tester.Object.TestPage(); tester.Object.ExecSql(); tester.Object.OtherTest(); } } Console.WriteLine("Finish!"); Console.ReadLine(); }
internal void SetRoundData(int currenttest, int TotalTests, BasicTest test) { TopHeader.text = "Round " + (currenttest) + " / " + TotalTests; Description.text = "<b>" + test.NumOfQuestions + "</b> " + test.Description; RoundImage.sprite = test.IntroImage; }
public OkraTest() { Describe("Okra", () => { When("a test class is defined", () => { Then("a 'describe' container is created with the correct description", () => { var subject = new BasicTest().Containers.First(); subject.ContainerType.ShouldBe(ContainerTypes.Description); subject.Description.ShouldBe("BasicTest"); }); When("a container defines before and after modifiers", () => { TestWithModifiers testClass = null; Container subject = null; BeforeEach(() => { testClass = new TestWithModifiers(); subject = testClass.Containers.First(); }); When("the test has a BeforeEach", () => { Then("the container is assigned the BeforeEach func", () => { subject.BeforeEach.Invoke(); testClass.ModifierOutput.ShouldBe("BeforeEach"); }); }); When("the test has a BeforeAll", () => { Then("the container is assigned the BeforeAll func", () => { subject.BeforeAll.Invoke(); testClass.ModifierOutput.ShouldBe("BeforeAll"); }); }); When("the test has a AfterEach", () => { Then("the container is assigned the AfterEach func", () => { subject.AfterEach.Invoke(); testClass.ModifierOutput.ShouldBe("AfterEach"); }); }); When("the test has a AfterAll", () => { Then("the container is assigned the AfterAll func", () => { subject.AfterAll.Invoke(); testClass.ModifierOutput.ShouldBe("AfterAll"); }); }); }); }); When("the test class contains tests", () => { Then("the container has a reference to the test", () => { var testContainer = new TestWithTests().Containers.First(); testContainer.Tests.Count().ShouldBe(1); var subject = testContainer.Tests.First(); subject.Description.ShouldBe("does a thing"); }); }); When("the test class has nested contexts", () => { Then("the top-level container has a reference to the child container", () => { var testClass = new TestWithNestedContexts(); testClass.Containers.Count().ShouldBe(1); var describeContainer = new TestWithNestedContexts().Containers.First(); describeContainer.Containers.Count().ShouldBe(1); var parentContainer = describeContainer.Containers.First(); parentContainer.Containers.Count().ShouldBe(1); parentContainer.Description.ShouldBe("parent context"); var childContainer = parentContainer.Containers.First(); childContainer.Description.ShouldBe("child context"); }); }); When("the test class has contexts with modifiers and tests", () => { Test subject = null; BeforeEach(() => subject = new TestWithModifiersAndTests().Containers.First().Containers.First().Tests.First()); It("orders the before each modifiers correctly", () => { subject.Description.ShouldBe("does a thing"); var first = subject.Before.Dequeue(); first.ShouldBe(TestWithModifiersAndTests.SampleInnerBeforeEach); var second = subject.Before.Dequeue(); second.ShouldBe(TestWithModifiersAndTests.SampleOuterBeforeEach); }); It("orders the after each modifiers correctly", () => { subject.Description.ShouldBe("does a thing"); var first = subject.After.Dequeue(); first.ShouldBe(TestWithModifiersAndTests.SampleInnerAfterEach); var second = subject.After.Dequeue(); second.ShouldBe(TestWithModifiersAndTests.SampleOuterAfterEach); }); It("orders the just before each modifiers correctly", () => { subject.Description.ShouldBe("does a thing"); var first = subject.JustBefore.Dequeue(); first.ShouldBe(TestWithModifiersAndTests.SampleJustBeforeEach); }); }); }); }
public bool NextTest(){ do { currentTestIndex++; } while(currentTestIndex < TestSeq.Length && Settings.Instance.GetProperty(Settings.SettingsTypes.QuestionsPerRound, currentTestIndex) == 0); _currentVisibleTest++; if (currentTestIndex == TestSeq.Length) { return false; } else { CompletedTests.Add(new CompletedTest() { TestType = TestSeq[currentTestIndex] }); foreach (Transform child in transform) { if (child.GetComponent < BasicTest> () && CompareTestTypes(child.GetComponent<BasicTest> ().TestType, TestSeq [currentTestIndex])) { currentTest = child.GetComponents<BasicTest> ().First((b => b.TestType == TestSeq[currentTestIndex])); currentTest.NumOfQuestions = Settings.Instance.GetProperty(Settings.SettingsTypes.QuestionsPerRound, currentTestIndex); CompletedTests[CompletedTests.Count - 1].CorrectQuestions = 0; CompletedTests[CompletedTests.Count - 1].TotalQuestions = currentTest.NumOfQuestions; } } TestProgress.Instance.SetNumOfQuestions(currentTest.NumOfQuestions); return true; } }
private bool CompareTestTypes(BasicTest.TestTypes TestA, BasicTest.TestTypes TestB) { if (TestA == TestB) return true; if (TestA == BasicTest.TestTypes.SingleSite && TestB == BasicTest.TestTypes.TwoSites) return true; if (TestA == BasicTest.TestTypes.SingleSite && TestB == BasicTest.TestTypes.SingleWithDistraction) return true; return false; }