public bool PosTest2()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest2: Equals should return true when comparing with instance of same classes");

        try
        {
            TestEmptyClass    ec1     = new TestEmptyClass();
            TestEmptyClass    ec2     = new TestEmptyClass();
            RuntimeTypeHandle handle1 = ec1.GetType().TypeHandle;
            RuntimeTypeHandle handle2 = ec2.GetType().TypeHandle;

            if (!handle1.Equals(handle2))
            {
                TestLibrary.TestFramework.LogError("002.1", "Equals returns false when comparing with instance of same classe");
                retVal = false;
            }

            TestStruct1 ts1 = new TestStruct1();
            TestStruct1 ts2 = new TestStruct1();
            handle1 = ts1.GetType().TypeHandle;
            handle2 = ts2.GetType().TypeHandle;
            if (!handle1.Equals(handle2))
            {
                TestLibrary.TestFramework.LogError("002.2", "Equals returns false when comparing with instance of same structs");
                retVal = false;
            }

            TestEnum1 te1 = TestEnum1.DEFAULT;
            TestEnum1 te2 = TestEnum1.DEFAULT;
            handle1 = te1.GetType().TypeHandle;
            handle2 = te2.GetType().TypeHandle;
            if (!handle1.Equals(handle2))
            {
                TestLibrary.TestFramework.LogError("002.3", "Equals returns false when comparing with instance of same enums");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002.4", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
        public static Complex dnaEnumParameters(TestEnum1 val1, TestEnum2 val2)
        {
            //return val.HasValue ? val.Value : TestEnum.Zero;
            double r = 0;

            if (val1 == TestEnum1.Negative)
            {
                r = -1;
            }
            else if (val1 == TestEnum1.Positive)
            {
                r = +1;
            }
            double c = 0;

            if (val2 == TestEnum2.Imaginary)
            {
                c = 1;
            }
            return(new Complex(r, c));
        }
Exemplo n.º 3
0
		TestEnum1 Convert(TestEnum1 val)
		{
			return val;
		}
Exemplo n.º 4
0
			public ObjectReference(TestEnum1 targetType, int tagetId)
			{
				TargetType = targetType;
				TargetID = tagetId;
			}
Exemplo n.º 5
0
 private TestEnum1 Convert(TestEnum1 val)
 {
     return(val);
 }
Exemplo n.º 6
0
 public ObjectReference(TestEnum1 targetType, int tagetId)
 {
     TargetType = targetType;
     TargetID   = tagetId;
 }
Exemplo n.º 7
0
 public FakeRoutableCommandWithEnum(TestEnum1 test1, TestEnum2 test2)
 {
     Test1 = test1;
     Test2 = test2;
 }
    public bool PosTest3()
    {
        bool retVal = true;

        TestLibrary.TestFramework.BeginScenario("PosTest3: Equals should return false when comparing with instance of different classes");

        try
        {
            TestEmptyClass    classInstance1       = new TestEmptyClass();
            TestClass         classInstance2       = new TestClass();
            RuntimeTypeHandle classInstanceHandle1 = classInstance1.GetType().TypeHandle;
            RuntimeTypeHandle classInstanceHandle2 = classInstance2.GetType().TypeHandle;

            if (classInstanceHandle1.Equals(classInstanceHandle2))
            {
                TestLibrary.TestFramework.LogError("003.1", "Equals returns true when comparing with instance of different classe");
                retVal = false;
            }

            TestStruct1       ts1           = new TestStruct1();
            TestStruct2       ts2           = new TestStruct2();
            RuntimeTypeHandle structHandle1 = ts1.GetType().TypeHandle;
            RuntimeTypeHandle structHandle2 = ts2.GetType().TypeHandle;
            if (structHandle1.Equals(structHandle2))
            {
                TestLibrary.TestFramework.LogError("003.2", "Equals returns false when comparing with instance of different structs");
                retVal = false;
            }

            TestEnum1         te1         = TestEnum1.DEFAULT;
            TestEnum2         te2         = TestEnum2.DEFAULT;
            RuntimeTypeHandle enumHandle1 = te1.GetType().TypeHandle;
            RuntimeTypeHandle enumHandle2 = te2.GetType().TypeHandle;
            if (enumHandle1.Equals(enumHandle2))
            {
                TestLibrary.TestFramework.LogError("003.3", "Equals returns false when comparing with instance of different enums");
                retVal = false;
            }

            if (classInstanceHandle1.Equals(structHandle1))
            {
                TestLibrary.TestFramework.LogError("003.4", "Equals returns false when comparing a instance of struct with a instance of class");
                retVal = false;
            }

            if (classInstanceHandle1.Equals(enumHandle1))
            {
                TestLibrary.TestFramework.LogError("003.5", "Equals returns false when comparing a instance of enum with a instance of class");
                retVal = false;
            }

            if (structHandle1.Equals(enumHandle1))
            {
                TestLibrary.TestFramework.LogError("003.6", "Equals returns false when comparing a instance of struct with a instance of enum");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("003.7", "Unexpected exception: " + e);
            TestLibrary.TestFramework.LogInformation(e.StackTrace);
            retVal = false;
        }

        return(retVal);
    }
Exemplo n.º 9
0
 /// <inheritdoc />
 /// <summary>
 /// inheritdoc TestMethod
 /// </summary>
 /// <exception cref="ArgumentException"></exception>
 /// <param name="param1">inheritdoc TestEnum1</param>
 /// <param name="param2">inheritdoc TestStruct1</param>
 public void TestMethod(TestEnum1 param1, TestStruct1 param2)
 {
     throw new System.NotImplementedException();
 }
 public EnumsCombined(TestEnum1 v)
 {
     Enum1 = v;
 }
 public static Complex dnaNullableEnum(TestEnum1? val1, TestEnum2? val2)
 {
     //return val.HasValue ? val.Value : TestEnum.Zero;
     double r = 0;
     if (val1.HasValue && val1 == TestEnum1.Negative)
         r = -1;
     else if (val1 == TestEnum1.Positive)
         r = +1;
     double c = 0;
     if (val2.HasValue && val2 == TestEnum2.Imaginary)
         c = 1;
     return new Complex(r, c);
 }
 public static Complex dnaEnumParameters(TestEnum1 val1, TestEnum2 val2)
 {
     //return val.HasValue ? val.Value : TestEnum.Zero;
     double r = 0;
     if (val1 == TestEnum1.Negative)
         r = -1;
     else if (val1 == TestEnum1.Positive)
         r = +1;
     double c = 0;
     if (val2 == TestEnum2.Imaginary)
         c = 1;
     return new Complex(r, c);
 }