本文整理汇总了C#中TestFrameWork类的典型用法代码示例。如果您正苦于以下问题:C# TestFrameWork类的具体用法?C# TestFrameWork怎么用?C# TestFrameWork使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
TestFrameWork类属于命名空间,在下文中一共展示了TestFrameWork类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Setup
public void Setup()
{
testFx = new TestFrameWork();
astLiveRunner = new ProtoScript.Runners.LiveRunner();
FFITarget.IncrementerTracedClass.ResetForNextTest();
}
示例2: ExecuteAndVerify
protected int ExecuteAndVerify(String code, ValidationData[] data, Dictionary<string, Object> context, out int nErrors)
{
ProtoCore.Core core = Setup();
ProtoScript.Runners.ProtoScriptTestRunner fsr = new ProtoScript.Runners.ProtoScriptTestRunner();
ExecutionMirror mirror = fsr.Execute(code, core, context);
int nWarnings = core.RuntimeStatus.WarningCount;
nErrors = core.BuildStatus.ErrorCount;
if (data == null)
{
core.Cleanup();
return nWarnings + nErrors;
}
TestFrameWork thisTest = new TestFrameWork();
foreach (var item in data)
{
if (item.ExpectedValue == null)
{
object nullOb = null;
TestFrameWork.Verify(mirror, item.ValueName, nullOb, item.BlockIndex);
}
else
{
TestFrameWork.Verify(mirror, item.ValueName, item.ExpectedValue, item.BlockIndex);
}
}
core.Cleanup();
return nWarnings + nErrors;
}
示例3: TestOverloadDispatchWithTypeConversion
public void TestOverloadDispatchWithTypeConversion()
{
String code =
@"class TestDefect
{
def foo(val : double)
{
return = val;
}
def foo(arr : double[])
{
return = -123;
}
def sqr(val : int)
{
return = val * val;
}
}
test = TestDefect.TestDefect();
arr = 5..25;
s = test.foo(arr);
";
ExecutionMirror mirror = thisTest.RunScriptSource(code);
TestFrameWork fx = new TestFrameWork();
TestFrameWork.Verify(mirror, "s", -123);
}
示例4: TestIncompatibleTypes
public void TestIncompatibleTypes()
{
String code =
@"def fun : double(arg: int) { return = 4; }
class A
{
x : int;
constructor A(_x : int) { x = _i; }
}
v1 = A.A(0);
v2 = fun(4);
v3 = fun ({0, 1});
v4 = fun ({A.A(0), A.A(1)});
";
ExecutionMirror mirror = thisTest.RunScriptSource(code);
TestFrameWork fx = new TestFrameWork();
TestFrameWork.Verify(mirror, "v2", 4.0);
}
示例5: Test2DnSquareCellArrayCallWithArgAssociative
public void Test2DnSquareCellArrayCallWithArgAssociative()
{
String code =
@"def fun : double(arg: double) { return = 4.0; }
a = fun({{1.0, 2.0, 3.0, 4.0}, {5.0, 6.0, 7.0, 8.0 }});
";
ExecutionMirror mirror = thisTest.RunScriptSource(code);
//Assert.Fail("1467075 - Sprint23 : rev 2660 : replication with nested array is not working as expected");
TestFrameWork fx = new TestFrameWork();
TestFrameWork.Verify(mirror, "a", new Object[] {
new Object[] {4.0, 4.0, 4.0, 4.0 },
new Object[] {4.0, 4.0, 4.0, 4.0 }});
}
示例6: Test1DnCellArrayCallWithArgAssociative
public void Test1DnCellArrayCallWithArgAssociative()
{
String code =
@"def fun : double(arg: double) { return = 4.0; }
a = fun({1.0, 2.0, 3.0, 4.0});
";
ExecutionMirror mirror = thisTest.RunScriptSource(code);
TestFrameWork fx = new TestFrameWork();
TestFrameWork.Verify(mirror, "a", new Object[] { 4.0, 4.0, 4.0, 4.0 });
}
示例7: T09_Defect_1456568_Replication_On_Operators
public void T09_Defect_1456568_Replication_On_Operators()
{
String code =
@"xdata = {1, 2};
ydata = {3, 4};
z = xdata + ydata;
";
ExecutionMirror mirror = thisTest.RunScriptSource(code);
TestFrameWork fx = new TestFrameWork();
Object[] v1 = new Object[] { 4, 6 };
TestFrameWork.Verify(mirror, "z", v1);
}
示例8: TestNamespaceImport
public void TestNamespaceImport()
{
string code =
@"import(MicroFeatureTests from ""ProtoTest.dll"");";
TestFrameWork theTest = new TestFrameWork();
var mirror = theTest.RunScriptSource(code);
TestFrameWork.VerifyBuildWarning(ProtoCore.BuildData.WarningID.kMultipleSymbolFound);
string[] classes = theTest.GetAllMatchingClasses("MicroFeatureTests");
Assert.True(classes.Length > 1, "More than one implementation of MicroFeatureTests class expected");
}
示例9: TestDefaultConstructorNotAvailableOnAbstractClass
public void TestDefaultConstructorNotAvailableOnAbstractClass()
{
string code = @"
import(""ProtoGeometry.dll"");
";
TestFrameWork theTest = new TestFrameWork();
ExecutionMirror mirror = theTest.RunScriptSource(code);
//Verify that Geometry.Geometry constructor deson't exists
theTest.VerifyMethodExists("Geometry", "Geometry", false);
}
示例10: TestNonBrowsableInterfaces
public void TestNonBrowsableInterfaces()
{
string code = @"
import(""ProtoGeometry.dll"");
";
TestFrameWork theTest = new TestFrameWork();
ExecutionMirror mirror = theTest.RunScriptSource(code);
Assert.IsTrue(theTest.GetClassIndex("Geometry") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IColor") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IDesignScriptEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IDisplayable") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IPersistentObject") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IPersistencyManager") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ICoordinateSystemEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IGeometryEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IPointEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ICurveEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ILineEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ICircleEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IArcEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IBSplineCurveEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IBRepEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ISurfaceEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IBSplineSurfaceEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IPlaneEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ISolidEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IPrimitiveSolidEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IConeEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ICuboidEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ISphereEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IPolygonEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ISubDMeshEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IBlockEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IBlockHelper") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ITopologyEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IShellEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ICellEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IFaceEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ICellFaceEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IVertexEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IEdgeEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("ITextEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("IGeometryFactory") == ProtoCore.DSASM.Constants.kInvalidIndex);
}
示例11: TestImportBrowsableClass
public void TestImportBrowsableClass()
{
string code = @"
import(NurbsCurve from ""ProtoGeometry.dll"");
";
TestFrameWork theTest = new TestFrameWork();
ExecutionMirror mirror = theTest.RunScriptSource(code);
//This import must import BSplineCurve and related classes.
Assert.IsTrue(theTest.GetClassIndex("Geometry") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("Point") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("Vector") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("Solid") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("Surface") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("Plane") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("CoordinateSystem") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("CoordinateSystem") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("Curve") != ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("NurbsCurve") != ProtoCore.DSASM.Constants.kInvalidIndex);
//Non-browsable as well as unrelated class should not be imported.
Assert.IsTrue(theTest.GetClassIndex("DesignScriptEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("Circle") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("SubDivisionMesh") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("GeometryFactory") == ProtoCore.DSASM.Constants.kInvalidIndex);
}
示例12: TestImportNonBrowsableClass
public void TestImportNonBrowsableClass()
{
string code = @"
import(DesignScriptEntity from ""ProtoGeometry.dll"");
";
TestFrameWork theTest = new TestFrameWork();
ExecutionMirror mirror = theTest.RunScriptSource(code);
Assert.IsTrue(theTest.GetClassIndex("Geometry") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("Point") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("DesignScriptEntity") == ProtoCore.DSASM.Constants.kInvalidIndex);
Assert.IsTrue(theTest.GetClassIndex("GeometryFactory") == ProtoCore.DSASM.Constants.kInvalidIndex);
}
示例13: TestIncompatibleTypes
public void TestIncompatibleTypes()
{
String code =
@"def fun : double(arg: int) { return = 4; }
v1 = Integer.ValueCtor(0);
v2 = fun(4);
v3 = fun ({0, 1});
v4 = fun ({Integer.ValueCtor(0), Integer.ValueCtor(1)});
";
ExecutionMirror mirror = thisTest.RunScriptSource(code);
TestFrameWork fx = new TestFrameWork();
TestFrameWork.Verify(mirror, "v2", 4.0);
}
示例14: Setup
public void Setup()
{
theTest = new TestFrameWork();
}
示例15: GetWatchValue
Assert.IsTrue((Int64)val.Payload == 202);
// expect to re-execute id2 = bar.ID
Assert.AreEqual(5, vms.ExecutionCursor.StartInclusive.LineNo);
vms = runner_.StepOver();
val = GetWatchValue(core_, @"id2");
Assert.IsTrue((Int64)val.Payload == 202);
}