本文整理汇总了C#中TestParameters类的典型用法代码示例。如果您正苦于以下问题:C# TestParameters类的具体用法?C# TestParameters怎么用?C# TestParameters使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestParameters类属于命名空间,在下文中一共展示了TestParameters类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: RunTest
public override void RunTest(ISyncLock lockObject, TestParameters testParameters)
{
if (lockObject is NoOpLock)
{
throw new InapplicableTestException("Unbalanced calls test not applicable for this lock type");
}
Console.WriteLine("Normal usage scenario -- autolock create / dispose with using");
ExerciseStandardUsage(lockObject, false);
Console.WriteLine("Normal usage scenario -- succeeded");
Console.WriteLine("Exception in using -- lock should be freed");
try
{
ExerciseStandardUsage(lockObject, true);
}
catch (IntentionalTestException e)
{
Console.WriteLine("Expected exception caught: {0}: {1}", e.GetType().ToString(), e.Message);
}
Console.WriteLine("Validate that the lock is freed by exercising the normal scenario again");
ExerciseStandardUsage(lockObject, false);
}
开发者ID:adamedx,项目名称:locktest,代码行数:28,代码来源:AutoLockTest.cs
示例2: INCCSR
public INCCSR(ShiftRegisterParameters sr, DataSourceIdentifier id, AcquireParameters acq, TestParameters test, LMLoggers.LognLM log)
{
sr_parms = new ShiftRegisterParameters(sr);
dsid = new DataSourceIdentifier(id);
dsid.SerialPort -= 1; // serial ports are 0 based at the HW layer
acquire_parms = new AcquireParameters(acq);
test_parms = new TestParameters(test);
this.log = log;
}
开发者ID:tempbottle,项目名称:INCC6,代码行数:9,代码来源:INCCSR.cs
示例3: RunTest
public override void RunTest(Synchronization.ISyncLock lockObject, TestParameters testParameters)
{
if (lockObject is NoOpLock)
{
throw new InapplicableTestException("Timeout tests are not needed for no op locks");
}
Console.WriteLine("Trying simple timed wait with long timeout");
bool acquired = lockObject.WaitForLock(new TimeSpan(1, 0, 0));
if (!acquired)
{
throw new InvalidOperationException("Unable to acquire lock in single thread scenario");
}
Console.WriteLine("Successfully acquired lock after bounded wait");
lockObject.Unlock();
//
// Wait for 0 seconds for lock after it is known to have been released
//
Console.WriteLine("Now wait for 0 and verify correct signaled state");
TestLockWait(lockObject, new TimeSpan(0, 0, 0), new TimeSpan(0,0,0), true);
//
// Signal, Wait for 0 secondsm
//
Console.WriteLine("Now acquire the lock and verify that it is acquired after the other thread holds it for 0 s");
TestLockWait(lockObject, new TimeSpan(0, 0, 5), new TimeSpan(0,0,0), false);
//
// Wait for 5s for a lock that is held for 3s
//
Console.WriteLine("Wait 5s for a lock held 3s");
TestLockWait(lockObject, new TimeSpan(0, 0, 5), new TimeSpan(0, 0, 3), false);
//
// Wait for 0s for a lock that is held for 3s -- lock should fail to be released
//
Console.WriteLine("Wait 0s for a lock held 3s");
TestLockWait(lockObject, new TimeSpan(0, 0, 0), new TimeSpan(0, 0, 3), false);
//
// Wait for 1s for a lock that is held for 4s -- lock should fail to be released
//
Console.WriteLine("Wait 1s for a lock held 4s");
TestLockWait(lockObject, new TimeSpan(0, 0, 1), new TimeSpan(0, 0, 4), false);
//
// Wait for 4s for a lock held 1s
//
Console.WriteLine("Wait 7s for a lock held 4s");
TestLockWait(lockObject, new TimeSpan(0, 0, 7), new TimeSpan(0, 0, 4), false);
}
开发者ID:adamedx,项目名称:locktest,代码行数:57,代码来源:TimeoutTest.cs
示例4: ParallelForBoundary3
public static void ParallelForBoundary3()
{
TestParameters parameters = new TestParameters(API.For64, StartIndexBase.Int16, 100)
{
Count = 1000,
WorkloadPattern = WorkloadPattern.Decreasing,
};
ParallelForTest test = new ParallelForTest(parameters);
test.RealRun();
}
开发者ID:johnhhm,项目名称:corefx,代码行数:10,代码来源:ParallelForBoundary.cs
示例5: ParallelForBoundary5
public static void ParallelForBoundary5()
{
TestParameters parameters = new TestParameters(API.For64, StartIndexBase.Int32, -100)
{
Count = 1000,
WorkloadPattern = WorkloadPattern.Similar,
};
ParallelForTest test = new ParallelForTest(parameters);
test.RealRun();
}
开发者ID:johnhhm,项目名称:corefx,代码行数:10,代码来源:ParallelForBoundary.cs
示例6: TestFor_Boundary
public static void TestFor_Boundary(API api, StartIndexBase startIndexBase, int startIndexOffset, int count, WorkloadPattern workloadPattern)
{
var parameters = new TestParameters(api, startIndexBase, startIndexOffset)
{
Count = count,
WorkloadPattern = workloadPattern,
};
var test = new ParallelForTest(parameters);
test.RealRun();
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:10,代码来源:ParallelForBoundary.cs
示例7: RunTest
public override void RunTest(ISyncLock syncLock, TestParameters testParameters)
{
this.syncLock = (ISyncLock)syncLock;
requireLock = !(syncLock is NoOpLock);
testTimeoutSeconds = testParameters.MaxWaitSeconds;
Thread[] threads = new Thread[desiredValues.Length];
for (int threadIndex = 0; threadIndex < threads.Length; threadIndex++)
{
threads[threadIndex] = new Thread(ContendingThreadFunction);
completedEvents[threadIndex] = new ManualResetEvent(false);
threads[threadIndex].Start(threadIndex);
}
startThreadsEvent.Set();
Console.WriteLine("Sleeping for {0} seconds", testParameters.MaxWaitSeconds);
Thread.Sleep(testParameters.MaxWaitSeconds * 1000);
Console.WriteLine("Signaling threads to terminate");
endTestEvent.Set();
Console.WriteLine("Waiting for {0} threads to complete after termination signal", threads.Length);
WaitHandle.WaitAll(completedEvents);
Console.WriteLine("Completed all waits for thread ids:");
for (int threadIndex = 0; threadIndex < threads.Length; threadIndex++)
{
Console.WriteLine("Thread: {0}\tIterations: {1}", threads[threadIndex].ManagedThreadId, iterationCounts[threadIndex]);
}
if (!requireLock)
{
if (!expectedSynchronizationErrorOccurred)
{
throw new InvalidOperationException("Expected synchronization error due to absence of lock did not occur.");
}
Console.WriteLine("Expected synchronization error successfully detected.");
}
else if (null != testException)
{
throw testException;
}
}
开发者ID:adamedx,项目名称:locktest,代码行数:54,代码来源:ConcurrencyTest.cs
示例8: ParrallelFor
public static void ParrallelFor(API api, StartIndexBase startIndexBase, int count, WithParallelOption parallelOption, ActionWithState stateOption, ActionWithLocal localOption)
{
var parameters = new TestParameters(api, startIndexBase)
{
Count = count,
ParallelOption = parallelOption,
StateOption = stateOption,
LocalOption = localOption
};
var test = new ParallelForTest(parameters);
test.RealRun();
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:12,代码来源:ParallelFor.cs
示例9: ParallelForTest4
public static void ParallelForTest4()
{
TestParameters parameters = new TestParameters(API.For64, StartIndexBase.Int32)
{
Count = 1,
ParallelOption = WithParallelOption.WithDOP,
StateOption = ActionWithState.None,
LocalOption = ActionWithLocal.HasFinally,
};
ParallelForTest test = new ParallelForTest(parameters);
test.RealRun();
}
开发者ID:rajeevkb,项目名称:corefx,代码行数:12,代码来源:ParallelFor.cs
示例10: TaskCreateTest3
public static void TaskCreateTest3()
{
TestParameters parameters = new TestParameters(TaskType.FutureT)
{
HasCancellationToken = true,
HasActionState = true,
HasTaskManager = false,
HasTaskOption = false,
ExceptionTestsAction = ExceptionTestsAction.None,
};
TaskCreateTest test = new TaskCreateTest(parameters);
test.CreateTask();
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:13,代码来源:TaskCreateTest.cs
示例11: ParallelForeachPartitioner3
public static void ParallelForeachPartitioner3()
{
TestParameters parameters = new TestParameters(API.Foreach, StartIndexBase.Zero)
{
Count = 10,
ChunkSize = 3,
PartitionerType = PartitionerType.RangePartitioner,
ParallelForeachDataSourceType = DataSourceType.Partitioner,
ParallelOption = WithParallelOption.WithDOP,
LocalOption = ActionWithLocal.None,
StateOption = ActionWithState.None,
};
ParallelForTest test = new ParallelForTest(parameters);
test.RealRun();
}
开发者ID:rajeevkb,项目名称:corefx,代码行数:15,代码来源:ParallelForeachPartitioner.cs
示例12: TestForeach_Partitioner
public static void TestForeach_Partitioner(int count, int chunkSize, PartitionerType partitionerType, WithParallelOption parallelOption, ActionWithLocal localOption, ActionWithState stateOption)
{
var parameters = new TestParameters(API.Foreach, StartIndexBase.Zero)
{
Count = count,
ChunkSize = chunkSize,
PartitionerType = partitionerType,
ParallelForeachDataSourceType = DataSourceType.Partitioner,
ParallelOption = parallelOption,
LocalOption = localOption,
StateOption = stateOption,
};
var test = new ParallelForTest(parameters);
test.RealRun();
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:15,代码来源:ParallelForeachPartitioner.cs
示例13: IDDTestParametersSetup
public IDDTestParametersSetup()
{
InitializeComponent();
tp = new TestParameters(NC.App.DB.TestParameters.Get()); // last one on the list is the newest one, we make local copy, and we update on the way out
if (tp == null)
{
tp = new TestParameters();
}
// Fill in the GUI elements with the current values stored in the local data structure
this.AccidentalsSinglesTestRateLimitTextBox.Text = tp.accSnglTestRateLimit.ToString("F2");
this.AccidentalsSinglesTestPrecisionLimitTextBox.Text = tp.accSnglTestPrecisionLimit.ToString("F2");
this.AccidentalsSinglesTestOutlierLimitTextBox.Text = tp.accSnglTestOutlierLimit.ToString("F2");
this.OutlierTestLimitTextBox.Text = tp.outlierTestLimit.ToString("F2");
this.MaxCyclesTextBox.Text = tp.maxCyclesForOutlierTest.ToString();
this.MaxChecksumTextBox.Text = tp.maxNumFailures.ToString();
this.ChecksumCheckbox.Checked = tp.checksum;
this.VerificationLimitTextBox.Text = tp.normalBackupAssayTestLimit.ToString("F2");
this.BackgroundDoublesRateLimitTextBox.Text = tp.bkgDoublesRateLimit.ToString("F2");
this.BackgroundTriplesRateLimitTextBox.Text = tp.bkgTriplesRateLimit.ToString("F2");;
this.ChiSquaredLimitTextBox.Text = tp.chiSquaredLimit.ToString("F2");
this.HighVoltageTestLimitTextBox.Text = tp.highVoltageTestLimit.ToString("F2");
this.MeasureAccidentalsRadioButton.Checked = (tp.accidentalsMethod == AccidentalsMethod.Measure ? true : false);
this.CalculateAccidentalsRadioButton.Checked = (tp.accidentalsMethod == AccidentalsMethod.Calculate ? true : false);
}
开发者ID:tempbottle,项目名称:INCC6,代码行数:24,代码来源:IDDTestParametersSetup.cs
示例14: BuildMeasurement
public unsafe bool BuildMeasurement(INCCTransferFile itf, int num)
{
bool overwrite = NC.App.AppContext.OverwriteImportedDefs;
results_rec results = itf.results_rec_list[0];
meas_id id;
TransferUtils.Copy(results.meas_date, 0, id.meas_date, 0, INCC.DATE_TIME_LENGTH);
TransferUtils.Copy(results.meas_time, 0, id.meas_time, 0, INCC.DATE_TIME_LENGTH);
TransferUtils.Copy(results.filename, 0, id.filename, 0, INCC.FILE_NAME_LENGTH);
TransferUtils.Copy(results.results_detector_id, 0, id.results_detector_id, 0, INCC.MAX_DETECTOR_ID_LENGTH);
DateTime dt = INCC.DateTimeFrom(TransferUtils.str(id.meas_date, INCC.DATE_TIME_LENGTH), TransferUtils.str(id.meas_time, INCC.DATE_TIME_LENGTH));
// do not use content from last BuildDetector call, instead look up the detector on the pre-existing list
string detname = TransferUtils.str(id.results_detector_id, INCC.MAX_DETECTOR_ID_LENGTH);
Detector det = NC.App.DB.Detectors.GetItByDetectorId(detname);
if (det == null)
{
mlogger.TraceEvent(LogLevels.Error, 34087, "Unknown detector '{0}', not importing this measurement {1}", detname, dt.ToString("s"));
return false;
}
meas = new Measurement((AssaySelector.MeasurementOption)results.meas_option, mlogger);
// TODO: update detector details from this meas result, since there could be a difference
meas.MeasurementId.MeasDateTime = dt;
meas.MeasurementId.FileName = TransferUtils.str(id.filename, INCC.FILE_NAME_LENGTH);
meas.Detectors.Add(det); // in practice this is a list with one element, e.g. meas.Detector
TestParameters t = new TestParameters();
t.accSnglTestRateLimit = results.r_acc_sngl_test_rate_limit;
t.accSnglTestPrecisionLimit = results.r_acc_sngl_test_precision_limit;
t.accSnglTestOutlierLimit = results.r_acc_sngl_test_outlier_limit;
t.outlierTestLimit = results.r_outlier_test_limit;
t.bkgDoublesRateLimit = results.r_bkg_doubles_rate_limit;
t.bkgTriplesRateLimit = results.r_bkg_triples_rate_limit;
t.chiSquaredLimit = results.r_chisq_limit;
t.maxNumFailures = results.r_max_num_failures;
t.highVoltageTestLimit = results.r_high_voltage_test_limit;
t.normalBackupAssayTestLimit = results.r_normal_backup_assay_test_lim;
t.maxCyclesForOutlierTest = (uint)results.r_max_runs_for_outlier_test;
t.checksum = (results.r_checksum_test == 0.0 ? false : true);
t.accidentalsMethod = INCCAccidentalsMethod((int)results.results_accidentals_method);
meas.Tests.Copy(t);
NormParameters n = NC.App.DB.NormParameters.Get(detname);
meas.Norm.Copy(n);
BackgroundParameters b = NC.App.DB.BackgroundParameters.Get(detname);
meas.Background.Copy(b);
// DB write for these occurs at end of processing here
// Isotopics handled in this block
if (itf.isotopics_table.Count > 0)
{
string isoname = TransferUtils.str(results.item_isotopics_id, INCC.MAX_ISOTOPICS_ID_LENGTH);
NCCTransfer.isotopics_rec isotopics = itf.isotopics_table[0];
//bool first = true; // forgot why the code does this, to put the default in the map?
// foreach (LMTransfer.isotopics_rec ir in itf.istopics_table)
// {
AnalysisDefs.Isotopics iso;
// if (first)
iso = meas.Isotopics;
// else
// iso = new Isotopics();
// first = false;
iso.am_date = INCC.DateFrom(TransferUtils.str(isotopics.am_date, INCC.DATE_TIME_LENGTH));
iso.pu_date = INCC.DateFrom(TransferUtils.str(isotopics.pu_date, INCC.DATE_TIME_LENGTH));
iso.id = TransferUtils.str(isotopics.isotopics_id, INCC.MAX_ISOTOPICS_ID_LENGTH);
AnalysisDefs.Isotopics.SourceCode checksc = AnalysisDefs.Isotopics.SourceCode.OD;
string check = TransferUtils.str(isotopics.isotopics_source_code, INCC.ISO_SOURCE_CODE_LENGTH);
bool okparse = Enum.TryParse(check, true, out checksc);
iso.source_code = checksc;
iso.SetValueError(Isotope.am241, isotopics.am241, isotopics.am241_err);
iso.SetValueError(Isotope.pu238, isotopics.pu238, isotopics.pu238_err);
iso.SetValueError(Isotope.pu239, isotopics.pu239, isotopics.pu239_err);
iso.SetValueError(Isotope.pu240, isotopics.pu240, isotopics.pu240_err);
iso.SetValueError(Isotope.pu241, isotopics.pu241, isotopics.pu241_err);
iso.SetValueError(Isotope.pu242, isotopics.pu242, isotopics.pu242_err);
if (!NC.App.DB.Isotopics.Has(iso.id))
{
NC.App.DB.Isotopics.GetList().Add(iso);
mlogger.TraceEvent(LogLevels.Info, 34021, "Identified new isotopics {0}", iso.id);
}
else
{
if (overwrite)
{
NC.App.DB.Isotopics.Replace(iso);
mlogger.TraceEvent(LogLevels.Warning, 34022, "Replaced existing isotopics {0}", iso.id);
}
else
{
mlogger.TraceEvent(LogLevels.Warning, 34022, "Not replacing existing isotopics {0}", iso.id);
}
}
iso.modified = true;
}
AcquireParameters acq = meas.AcquireState;
//.........这里部分代码省略.........
开发者ID:hnordquist,项目名称:INCC6,代码行数:101,代码来源:INCCKnew.cs
示例15: ParallelForeachPartitioner5
public static void ParallelForeachPartitioner5()
{
TestParameters parameters = new TestParameters(API.Foreach, StartIndexBase.Zero)
{
Count = 1,
ChunkSize = -1,
PartitionerType = PartitionerType.ArrayBalancedOOB,
ParallelForeachDataSourceType = DataSourceType.Partitioner,
ParallelOption = WithParallelOption.None,
LocalOption = ActionWithLocal.None,
StateOption = ActionWithState.None,
};
ParallelForTest test = new ParallelForTest(parameters);
test.RealRun();
}
开发者ID:rajeevkb,项目名称:corefx,代码行数:15,代码来源:ParallelForeachPartitioner.cs
示例16: TaskCreateTest
public TaskCreateTest(TestParameters parameters)
{
_taskType = parameters.TaskType;
_hasTaskManager = parameters.HasTaskManager;
_hasActionState = parameters.HasActionState;
_hasTaskOption = parameters.HasTaskOption;
_hasCancellationToken = parameters.HasCancellationToken;
_exceptionTestsAction = parameters.ExceptionTestsAction;
}
开发者ID:ChuangYang,项目名称:corefx,代码行数:9,代码来源:TaskCreateTest.cs
示例17: ParseCommand
public override void ParseCommand(CommandCreationParam commandCreationParam){
base.ParseCommand(commandCreationParam);
_testParameters = commandCreationParam.TestParameters;
}
开发者ID:aries544,项目名称:eXpand,代码行数:4,代码来源:UseModelCommand.cs
示例18: ParallelForTest47
public static void ParallelForTest47()
{
TestParameters parameters = new TestParameters(API.Foreach, StartIndexBase.Zero)
{
Count = 97,
ParallelOption = WithParallelOption.WithDOP,
StateOption = ActionWithState.Stop,
LocalOption = ActionWithLocal.None,
};
ParallelForTest test = new ParallelForTest(parameters);
test.RealRun();
}
开发者ID:rajeevkb,项目名称:corefx,代码行数:12,代码来源:ParallelFor.cs
示例19: Test
private void Test(TestParameters[] tests)
{
PriorStudyLoaderExceptionPolicy.Reset();
var policy = new PriorStudyLoaderExceptionPolicy();
var context = new Context();
foreach (var test in tests)
{
//reset.
context.ShowedMessageBox = false;
if (test.FindFailed || !test.ResultsComplete)
{
var exception = test.FindFailed
? new LoadPriorStudiesException()
: new LoadPriorStudiesException(test.OtherExceptions, test.StudyCount, test.ResultsComplete);
PriorStudyLoaderExceptionPolicy.NotifyFailedQuery();
policy.Handle(exception, context);
Assert.AreEqual(test.MessageBoxExpected, context.ShowedMessageBox);
}
else
{
PriorStudyLoaderExceptionPolicy.NotifySuccessfulQuery();
if (test.OtherExceptions.Count > 0)
{
var exception = new LoadPriorStudiesException(test.OtherExceptions, test.StudyCount, test.ResultsComplete);
policy.Handle(exception, context);
}
Assert.AreEqual(test.MessageBoxExpected, context.ShowedMessageBox);
}
}
}
开发者ID:nhannd,项目名称:Xian,代码行数:35,代码来源:PriorStudyFinderTests.cs
示例20: RunTest
public override void RunTest(ISyncLock lockObject, TestParameters testParameters)
{
if (lockObject is NoOpLock)
{
throw new InapplicableTestException("Unbalanced calls test not applicable for this lock type");
}
ISyncLock syncLock = (ISyncLock)lockObject;
Exception releaseUnlockedException = null;
Console.WriteLine("Trying unlock with no lock -- this should fail");
try
{
syncLock.Unlock();
}
catch (InvalidOperationException e)
{
Console.WriteLine("Caught expected InvalidOperationException");
releaseUnlockedException = e;
}
Console.WriteLine("Lock / unlock succeeded");
if (releaseUnlockedException == null)
{
throw new InvalidOperationException("Unlock of already unlocked lock should not have succeeded");
}
Console.WriteLine("Simple lock / unlock -- this should succeed");
syncLock.Lock();
syncLock.Unlock();
Console.WriteLine("Re-entrant lock scenario -- try locking twice -- this should fail for some locks, succeed for others");
Exception reentrantLockException = null;
syncLock.Lock();
try
{
Console.WriteLine("Second lock attempt");
syncLock.Lock();
Console.WriteLine("Second lock granted");
}
catch (InvalidOperationException e)
{
Console.WriteLine("Expected InvalidOperationException caught");
reentrantLockException = e;
}
syncLock.Unlock();
if (syncLock.GetType() == typeof(SimpleSpinLock))
{
if (reentrantLockException == null)
{
throw new InvalidOperationException("Lock should not allow re-entrant call to already locked lock");
}
}
else
{
Console.WriteLine("Successful re-entrant lock with lock count 2, now perform extra unlock");
syncLock.Unlock();
Console.WriteLine("Successfully performed second unlock");
VerifyUnlocked(syncLock);
}
// Now test higher scale re-entrance
Console.WriteLine("Testing locking {0} times on the same thread, then unlocking the same #", lockMax);
if (!(syncLock is SimpleSpinLock))
{
for (int lockCount = 0; lockCount < lockMax; lockCount++)
{
syncLock.Lock();
}
for (int unlockCount = 0; unlockCount < lockMax; unlockCount++)
{
syncLock.Unlock();
}
VerifyUnlocked(syncLock);
}
Console.WriteLine("Successfully verified lock re-entrance count for non-trivial number of re-entrant calls");
Console.WriteLine("Lock once, unlock twice -- this should fail");
syncLock.Lock();
syncLock.Unlock();
Exception unbalancedException = null;
//.........这里部分代码省略.........
开发者ID:adamedx,项目名称:locktest,代码行数:101,代码来源:UnbalancedCallTest.cs
注:本文中的TestParameters类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论