private static void ThreadWorker() { TestConcurrency t = test; for (int i = 0; i < NumCalls; i++) { HelperMethod(t); } }
public VisualGridRunner(RunnerOptions runnerOptions, string suiteName, ILogHandler logHandler = null) { runnerOptions_ = runnerOptions; testConcurrency_ = new TestConcurrency(((IRunnerOptionsInternal)runnerOptions).GetConcurrency(), false); if (logHandler != null) { Logger.SetLogHandler(logHandler); } Init(suiteName); }
private static void HelperMethod(TestConcurrency t) { TestConcurrency t2 = t; TestConcurrency t3 = t2; for (int i = 0; i < NumIterations; i++) { t = t3; t2 = t; t3 = t2; } }
public VisualGridRunner(RunnerOptions runnerOptions, string suiteName, IServerConnectorFactory serverConnectorFactory, ILogHandler logHandler = null) { ServerConnectorFactory = serverConnectorFactory; ServerConnector = serverConnectorFactory.CreateNewServerConnector(Logger, new Uri("https://some.url.com")); runnerOptions_ = runnerOptions; testConcurrency_ = new TestConcurrency(((IRunnerOptionsInternal)runnerOptions).GetConcurrency(), false); if (logHandler != null) { Logger.SetLogHandler(logHandler); } Init(suiteName); }
public static void Main() { // make sure we deal with exceptions thrown on the threads AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler); test = new TestConcurrency(); for (int i = 0; i < NumThreads; i++) { Thread t = new Thread(new ThreadStart(ThreadProc)); t.Start(); } int remainingThreads = 0; while (remainingThreads < NumThreads) { Interlocked.Exchange(ref remainingThreads, liveThreads); Thread.Sleep(50); } while (true) { remainingThreads = int.MaxValue; Interlocked.Exchange(ref remainingThreads, liveThreads); Console.WriteLine(remainingThreads); if (remainingThreads <= 0) { break; } // make the allocator work a little too TestConcurrency t3 = new TestConcurrency(); Thread.Sleep(50); } int refcount = GC.ReferenceCount(test); Console.WriteLine("Final reference count: {0}", refcount); if (refcount != 1) { Console.WriteLine("Expected reference count to be 1, is {0}", refcount); Environment.Exit(1); } }
public static void Main() { // make sure we deal with exceptions thrown on the threads AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(ExceptionHandler); test = new TestConcurrency(); for( int i = 0; i < NumThreads; i++ ) { Thread t = new Thread( new ThreadStart(ThreadProc) ); t.Start(); } int remainingThreads = 0; while ( remainingThreads < NumThreads ) { Interlocked.Exchange( ref remainingThreads, liveThreads ); Thread.Sleep(50); } while( true ) { remainingThreads = int.MaxValue; Interlocked.Exchange( ref remainingThreads, liveThreads ); Console.WriteLine( remainingThreads ); if ( remainingThreads <= 0 ) break; // make the allocator work a little too TestConcurrency t3 = new TestConcurrency(); Thread.Sleep( 50 ); } int refcount = GC.ReferenceCount(test); Console.WriteLine( "Final reference count: {0}", refcount); if ( refcount != 1 ) { Console.WriteLine( "Expected reference count to be 1, is {0}", refcount ); Environment.Exit(1); } }
static void Main(string[] args) { Console.WriteLine("SQL Server Entity Framework Test..."); // 测试延迟加载. TestLazyLoading.DoTest(); // 测试 identity. TestIdentity.DoTest(); // 测试 存储过程 TestCallProcedure.DoTest(); // 测试 事务处理. TestTransaction.DoTest(); // 测试 多次查询. TestMulQuery.DoTest(); // 测试并发处理. TestConcurrency.DoTest(); // Model First 的测试. // TestModelFirst.DoTest(); Console.ReadLine(); }
static void Main(string[] args) { Console.WriteLine("Oracle Entity Framework Test..."); // 测试直接执行 SQL 语句. TestExecSql.DoTest(); // 测试延迟加载. TestLazyLoading.DoTest(); // 测试 序列号. TestSequence.DoTest(); // 测试 存储过程 TestCallProcedure.DoTest(); // 测试 事务处理. TestTransaction.DoTest(); // 测试 多次查询. TestMulQuery.DoTest(); // 测试并发处理. TestConcurrency.DoTest(); Console.ReadLine(); }
private static void HelperMethod( TestConcurrency t ) { TestConcurrency t2 = t; TestConcurrency t3 = t2; for ( int i = 0; i < NumIterations; i++ ) { t = t3; t2 = t; t3 = t2; } }
// EXECUTE TESTS private async Task InternalExecute(string ttName, string username, string password, string userRole) { try { string token = GetOAuthToken(ttName, username, password, userRole); using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", token); // Mark Definitions... TestMarkDefinitions test1 = new TestMarkDefinitions(client, FBaseUri); FPassed = await test1.Run() && FPassed; // Register Summaries... TestRegisterSummaries test2 = new TestRegisterSummaries(client, FBaseUri); FPassed = await test2.Run() && FPassed; // Registers... TestRegisters test3 = new TestRegisters(client, FBaseUri); FPassed = await test3.Run() && FPassed; // Student Ledgers... TestStudentLedger test4 = new TestStudentLedger(client, FBaseUri, test3.Registers); FPassed = await test4.Run() && FPassed; // Student Marks... TestStudentMarks test5 = new TestStudentMarks(client, FBaseUri, test3.Registers); FPassed = await test5.Run() && FPassed; // Student Exceptions... TestStudentExceptions test6 = new TestStudentExceptions(client, FBaseUri, test3.Registers, test2.SomeRegisterDates, test1.MarkDefinitions); FPassed = await test6.Run() && FPassed; // OLA Staging... TestOLA test7 = new TestOLA(client, FBaseUri); FPassed = await test7.Run() && FPassed; // Student in/out times TestStudentTimes test8 = new TestStudentTimes(client, FBaseUri, test3.Registers); FPassed = await test8.Run() && FPassed; TestConcurrency finalTest = new TestConcurrency(client, FBaseUri); finalTest.Run(); } } catch (WebException wex) { FPassed = false; var resp = wex.Response; if (resp != null) { var responseStream = resp.GetResponseStream(); if (responseStream != null) { using (var reader = new StreamReader(responseStream)) { Console.WriteLine(wex.Message + " " + reader.ReadToEnd()); } } } } catch (Exception ex) { FPassed = false; Console.WriteLine(ex.Message); } }
public VisualGridRunner(int concurrentOpenSessions, string suiteName, ILogHandler logHandler = null) : this(new RunnerOptions().TestConcurrency(concurrentOpenSessions * CONCURRENCY_FACTOR), suiteName, logHandler) { testConcurrency_ = new TestConcurrency(concurrentOpenSessions, true); }
public VisualGridRunner(string suiteName = null, ILogHandler logHandler = null) : this(new RunnerOptions().TestConcurrency(DEFAULT_CONCURRENCY), suiteName, logHandler) { testConcurrency_ = new TestConcurrency(); }