本文整理汇总了C#中Test.Framework.TestResult类的典型用法代码示例。如果您正苦于以下问题:C# Test.Framework.TestResult类的具体用法?C# Test.Framework.TestResult怎么用?C# Test.Framework.TestResult使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Test.Framework.TestResult类属于命名空间,在下文中一共展示了Test.Framework.TestResult类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
/// <summary>
/// Tests the initial default DataWriterQos and the getting and setting
/// of the default DataWriterQos in the Publisher.
/// </summary>
/// <remarks>
/// Tests the initial default DataWriterQos and the getting and setting
/// of the default DataWriterQos in the Publisher.
/// </remarks>
public override Test.Framework.TestResult Run()
{
DDS.IPublisher publisher;
DDS.DataWriterQos qos = null;
string expResult = "DataWriterQos test succeeded";
Test.Framework.TestResult result;
DDS.ReturnCode rc;
result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
publisher = (DDS.IPublisher)this.ResolveObject("publisher");
if (publisher.GetDefaultDataWriterQos(ref qos) != DDS.ReturnCode.Ok)
{
result.Result = "Failed to get the default datawriter qos (1)";
return result;
}
if (!test.sacs.QosComparer.DataWriterQosEquals(qos, test.sacs.QosComparer.defaultDataWriterQos
))
{
result.Result = "The default DataWriterQos != default (2)";
return result;
}
qos.Deadline.Period.NanoSec = DDS.Duration.InfiniteNanoSec + 1;
rc = publisher.SetDefaultDataWriterQos(qos);
if (rc != DDS.ReturnCode.BadParameter)
{
result.Result = "Received return code " + rc + " but expected RETCODE_BAD_PARAMETER (3)";
return result;
}
if (publisher.GetDefaultDataWriterQos(ref qos) != DDS.ReturnCode.Ok)
{
result.Result = "Failed to get the default datawriter qos (4)";
return result;
}
if (!test.sacs.QosComparer.DataWriterQosEquals(qos, test.sacs.QosComparer.defaultDataWriterQos))
{
result.Result = "The default DataWriterQos != default (4)";
return result;
}
qos.History.Depth = 8;
qos.ResourceLimits.MaxSamplesPerInstance = 2;
rc = publisher.SetDefaultDataWriterQos(qos);
if (rc != DDS.ReturnCode.InconsistentPolicy)
{
result.Result = "Received return code " + rc + " but expected RETCODE_INCONSISTENT_POLICY (5)";
return result;
}
result.Result = expResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例2: Run
public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
{
string expectedResult = "Topic is deinitialized";
DDS.IDomainParticipant participant;
DDS.ITopic topic;
DDS.ReturnCode rc;
Test.Framework.TestResult result;
result = new Test.Framework.TestResult(expectedResult, string.Empty, Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
topic = (DDS.ITopic)testCase.ResolveObject("topic");
rc = participant.DeleteTopic(topic);
if (rc == DDS.ReturnCode.PreconditionNotMet)
{
rc = participant.DeleteContainedEntities();
}
if (rc != DDS.ReturnCode.Ok)
{
result.Result = "Recieved return code " + rc + " after calling participant.delete_topic";
return result;
}
testCase.UnregisterObject("topic");
result.Result = expectedResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例3: Run
public override Test.Framework.TestResult Run()
{
DDS.IDataReader reader;
DDS.DataReaderQos qos = null;
DDS.DataReaderQos qos2 = null;
DDS.DataReaderQos holder = null;
DDS.ReturnCode rc;
Test.Framework.TestResult result;
string expResult = "Reader test succeeded.";
result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
reader = (DDS.IDataReader)this.ResolveObject("datareader");
qos = (DDS.DataReaderQos)this.ResolveObject("datareaderQos");
if (reader.GetQos(ref holder) != DDS.ReturnCode.Ok)
{
result.Result = "Qos of DataReader could not be resolved.";
return result;
}
if (!test.sacs.QosComparer.DataReaderQosEquals(holder, qos))
{
result.Result = "Qos of DataReader does not match provided qos.";
return result;
}
if (!test.sacs.QosComparer.DataReaderQosEquals(holder, test.sacs.QosComparer.defaultDataReaderQos))
{
result.Result = "Qos of DataWriter does not match default qos.";
return result;
}
qos2 = holder;
qos2.Deadline.Period = new DDS.Duration(3, 3);
qos2.LatencyBudget.Duration = new DDS.Duration(6, 6);
qos2.ReaderDataLifecycle.AutopurgeDisposedSamplesDelay = new DDS.Duration(
5, 5);
qos2.ReaderDataLifecycle.EnableInvalidSamples = false;
qos2.ReaderDataLifecycle.InvalidSampleVisibility.Kind = DDS.InvalidSampleVisibilityQosPolicyKind.MinimumInvalidSamples;
qos2.UserData.Value = new byte[2];
qos2.UserData.Value[0] = 2;
qos2.UserData.Value[0] = 4;
rc = reader.SetQos(qos2);
if (rc != DDS.ReturnCode.Ok)
{
result.Result = "New Qos could not be applied.";
return result;
}
if (reader.GetQos(ref holder) != DDS.ReturnCode.Ok)
{
result.Result = "Qos of DataReader could not be resolved (2).";
return result;
}
if (!test.sacs.QosComparer.DataReaderQosEquals(holder, qos2))
{
result.Result = "Qos of DataReader does not match provided qos (2).";
return result;
}
result.Result = expResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例4: Run
public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
{
DDS.IDomainParticipant participant;
DDS.ITopic topic;
DDS.ReturnCode rc;
Test.Framework.TestResult result;
result = new Test.Framework.TestResult("Deinitialization success", string.Empty,
Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Fail);
participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
topic = (DDS.ITopic)testCase.ResolveObject("topic");
rc = participant.DeleteTopic(topic);
if (rc != DDS.ReturnCode.Ok)
{
if (rc == DDS.ReturnCode.PreconditionNotMet)
{
rc = participant.DeleteContainedEntities();
}
if (rc != DDS.ReturnCode.Ok)
{
result.Result = "Could not delete Topic.";
return result;
}
}
testCase.UnregisterObject("topic");
result.Result = "Deinitialization success.";
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例5: Run
public override Test.Framework.TestResult Run()
{
DDS.IDomainParticipant participant1;
DDS.IDomainParticipant lookedUpParticipant1;
DDS.DomainParticipantFactory factory;
Test.Framework.TestResult result = new Test.Framework.TestResult("lookup returns the same objects as where originally created"
, "OK", Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Pass);
factory = (DDS.DomainParticipantFactory)ResolveObject("theFactory");
participant1 = (DDS.IDomainParticipant)ResolveObject("participant1");
lookedUpParticipant1 = factory.LookupParticipant(string.Empty);
if (participant1 != lookedUpParticipant1)
{
result.Result = "participant1 and lookedUpParticipant1 differ";
result.Verdict = Test.Framework.TestVerdict.Fail;
return result;
}
lookedUpParticipant1 = null;
lookedUpParticipant1 = factory.LookupParticipant("file://rubbish");
if (lookedUpParticipant1 != null)
{
result.Result = "lookup returned a participant after looking for a non existing participant";
result.Verdict = Test.Framework.TestVerdict.Fail;
return result;
}
lookedUpParticipant1 = null;
lookedUpParticipant1 = factory.LookupParticipant(string.Empty);
if (lookedUpParticipant1 != participant1)
{
result.Result = "lookup didn't return the expected participant";
result.Verdict = Test.Framework.TestVerdict.Fail;
return result;
}
return result;
}
示例6: Run
public override Test.Framework.TestResult Run()
{
DDS.ReturnCode rc;
string expResult = "null pointer struct returns BAD_PARAMETER";
Test.Framework.TestResult result = new Test.Framework.TestResult(
expResult,
string.Empty,
Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
if (result.Result != string.Empty)
{
return result;
}
bce.message2 = new mod.embeddedStructType();
bce.message2.tstStr = null;
rc = bce.datawriter2.Write(bce.message2, 0);
if (rc != DDS.ReturnCode.BadParameter)
{
result.Result = "null pointer struct did NOT return BAD_PARAMETER.";
return result;
}
result.Result = expResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例7: Run
public override Test.Framework.TestResult Run()
{
DDS.ReturnCode rc;
string expResult = "struct array with too big size returns BAD_PARAMETER";
Test.Framework.TestResult result = new Test.Framework.TestResult(
expResult,
string.Empty,
Test.Framework.TestVerdict.Fail,
Test.Framework.TestVerdict.Fail);
if (result.Result != string.Empty)
{
return result;
}
bce.message2 = new mod.embeddedStructType();
bce.message2.tstArr = new mod.tst[4];
for (int i = 0; i < 4; i++) {
bce.message2.tstArr[i] = new mod.tst(); // Prevent uninitialized array from causing error.
}
// scdds2162 - Once solved for CopyIn, re-enable the Write instruction.
//rc = bce.datawriter2.Write(bce.message2, 0);
rc = DDS.ReturnCode.Ok; // Temporary to make testcase FAIL. Please Remove when Write is re-enabled.
if (rc != DDS.ReturnCode.BadParameter)
{
result.Result = "struct array with too big size did NOT return BAD_PARAMETER.";
this.testFramework.TestMessage(Test.Framework.TestMessage.Note, "See scdds2162: CopyIn should do more validity checking.");
return result;
}
result.Result = expResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例8: Run
public override Test.Framework.TestResult Run()
{
DDS.IPublisher publisher;
DDS.DataWriterQos dataWriterQos = null;
DDS.DataWriterQos qosHolder1 = null;
DDS.ITopic topic;
string expResult = "copy_from_topic_qos rejects TOPIC_QOS_DEFAULT with correct code.";
Test.Framework.TestResult result;
DDS.ReturnCode rc = DDS.ReturnCode.Error;
result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
publisher = (DDS.IPublisher)this.ResolveObject("publisher");
topic = (DDS.ITopic)this.ResolveObject("topic");
if (publisher.GetDefaultDataWriterQos(ref qosHolder1) != DDS.ReturnCode.Ok)
{
result.Result = "Could not retrieve default DataWriterQos";
return result;
}
dataWriterQos = qosHolder1;
dataWriterQos.History.Kind = DDS.HistoryQosPolicyKind.KeepAllHistoryQos;
dataWriterQos.History.Depth = 150;
// TODO: JLS, Verify the intent of this BadParameter test.
DDS.TopicQos defaultTopicQos = null;
rc = publisher.CopyFromTopicQos(ref qosHolder1, defaultTopicQos);
if (rc != DDS.ReturnCode.BadParameter)
{
result.Result = "copy_from_topic_qos returns wrong code (RETCODE = " + rc + ").";
return result;
}
result.Result = expResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例9: Run
public override Test.Framework.TestResult Run()
{
DDS.ITopic topic;
DDS.InconsistentTopicStatus status = new DDS.InconsistentTopicStatus();
string expResult = "Topic status test succeeded";
Test.Framework.TestResult result;
DDS.ReturnCode rc;
result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
topic = (DDS.ITopic)this.ResolveObject("topic");
rc = topic.GetInconsistentTopicStatus(ref status);
if (rc != DDS.ReturnCode.Ok)
{
result.Result = "InconsistentTopicStatus could not be resolved.";
return result;
}
if (status.TotalCount != 0)
{
result.Result = "InconsistentTopicStatus.TotalCount != 0.";
return result;
}
if (status.TotalCountChange != 0)
{
result.Result = "InconsistentTopicStatus.TotalCountChange != 0.";
return result;
}
result.Result = expResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例10: Run
public override Test.Framework.TestResult Run()
{
string expResult = "ContentFilteredTopic test succeeded";
string[] expressionParameters;
DDS.IDomainParticipant participant;
DDS.ITopic topic;
DDS.IContentFilteredTopic filteredTopic;
Test.Framework.TestResult result;
result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
topic = (DDS.ITopic)this.ResolveObject("topic");
participant = (DDS.IDomainParticipant)this.ResolveObject("participant");
expressionParameters = new string[102];
Utils.FillStringArray(ref expressionParameters, "10");
if (topic == null || participant == null)
{
System.Console.Error.WriteLine("participant or topic = null");
result.Result = "precondition not met";
return result;
}
expressionParameters[101] = "5";
filteredTopic = participant.CreateContentFilteredTopic("filtered_topic", topic,
"long_1 > %101", expressionParameters);
if (filteredTopic != null)
{
System.Console.Out.WriteLine("NOTE\t\t: See STR/CP TH281");
participant.DeleteContentFilteredTopic(filteredTopic);
result.ExpectedVerdict = Test.Framework.TestVerdict.Fail;
result.Result = "Could create a ContentFilteredTopic with an expression parameter %101 ";
return result;
}
result.Result = expResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例11: Run
public override Test.Framework.TestResult Run()
{
DDS.ReturnCode rc;
string expResult = "struct array with correct size returns Ok";
Test.Framework.TestResult result = new Test.Framework.TestResult(
expResult,
string.Empty,
Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
if (result.Result != string.Empty)
{
return result;
}
bce.message2 = new mod.embeddedStructType();
bce.message2.tstArr = new mod.tst[3];
for (int i = 0; i < 3; i++) {
bce.message2.tstArr[i] = new mod.tst(); // Prevent uninitialized array from causing error.
}
rc = bce.datawriter2.Write(bce.message2, 0);
if (rc != DDS.ReturnCode.Ok)
{
result.Result = "struct array with correct size did NOT return Ok.";
return result;
}
result.Result = expResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例12: Run
public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
{
DDS.DomainParticipantFactory factory;
DDS.IDomainParticipant participant;
DDS.DomainParticipantQos pqosHolder = null;
Test.Framework.TestResult result;
result = new Test.Framework.TestResult("Initialization success", string.Empty, Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
factory = DDS.DomainParticipantFactory.Instance;
if (factory == null)
{
result.Result = "DomainParticipantFactory could not be initialized.";
return result;
}
if (factory.GetDefaultParticipantQos(ref pqosHolder) != DDS.ReturnCode.Ok)
{
result.Result = "Default DomainParticipantQos could not be resolved.";
return result;
}
participant = factory.CreateParticipant(DDS.DomainId.Default, pqosHolder);//, null, 0);
if (participant == null)
{
result.Result = "Creation of DomainParticipant failed.";
return result;
}
testCase.RegisterObject("participantQos", pqosHolder);
testCase.RegisterObject("factory", factory);
testCase.RegisterObject("participant", participant);
result.Result = "Initialization success.";
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例13: Run
public override Test.Framework.TestResult Run()
{
DDS.ISubscriber subscriber;
string expResult = "Functions not supported yet.";
Test.Framework.TestResult result;
DDS.ReturnCode rc;
result = new Test.Framework.TestResult(expResult, string.Empty, Test.Framework.TestVerdict
.Pass, Test.Framework.TestVerdict.Fail);
subscriber = (DDS.ISubscriber)this.ResolveObject("subscriber");
subscriber.NotifyDataReaders();
rc = subscriber.BeginAccess();
if (rc != DDS.ReturnCode.Unsupported)
{
result.Result = "subscriber.begin_access has been implemented.";
return result;
}
rc = subscriber.EndAccess();
if (rc != DDS.ReturnCode.Unsupported)
{
result.Result = "subscriber.end_access has been implemented.";
return result;
}
result.Result = "Functions not supported yet.";
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例14: Run
public override Test.Framework.TestResult Run()
{
DDS.ReturnCode rc;
string expResult = "sequence of structs with length > bound returns BadParameter";
Test.Framework.TestResult result = new Test.Framework.TestResult(
expResult,
string.Empty,
Test.Framework.TestVerdict.Pass,
Test.Framework.TestVerdict.Fail);
if (result.Result != string.Empty)
{
return result;
}
bce.message2 = new mod.embeddedStructType();
for (int i = 0; i < 3; i++) {
bce.message2.tstArr[i] = new mod.tst(); // Prevent uninitialized array from causing error.
}
bce.message2.tstSeq = new mod.tst[4];
for (int i = 0; i < 4; i++) {
bce.message2.tstSeq[i] = new mod.tst(); // Prevent uninitialized sequence elements from causing error.
}
rc = bce.datawriter2.Write(bce.message2, 0);
if (rc != DDS.ReturnCode.BadParameter)
{
result.Result = "sequence of structs with length > bound did NOT return BadParameter.";
return result;
}
result.Result = expResult;
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}
示例15: Run
public override Test.Framework.TestResult Run(Test.Framework.TestCase testCase)
{
DDS.IDomainParticipantFactory factory;
DDS.IDomainParticipant participant;
Test.Framework.TestResult result;
DDS.ReturnCode rc;
result = new Test.Framework.TestResult("Deinitialization success", string.Empty,
Test.Framework.TestVerdict.Pass, Test.Framework.TestVerdict.Fail);
factory = (DDS.IDomainParticipantFactory)testCase.ResolveObject("factory");
participant = (DDS.IDomainParticipant)testCase.ResolveObject("participant");
if (participant == null)
{
result.Result = "DomainParticipant could not be found.";
return result;
}
rc = participant.DeleteContainedEntities();
if (rc != DDS.ReturnCode.Ok)
{
result.Result = "Could not delete contained entities of DomainParticipant.";
return result;
}
rc = factory.DeleteParticipant(participant);
if (rc != DDS.ReturnCode.Ok)
{
result.Result = "Could not delete DomainParticipant.";
return result;
}
testCase.UnregisterObject("participant");
testCase.UnregisterObject("participantQos");
testCase.UnregisterObject("factory");
result.Result = "Deinitialization success.";
result.Verdict = Test.Framework.TestVerdict.Pass;
return result;
}