public bool PosTest2()
    {
        bool retVal = true;

        int expectedValue = int.MaxValue;
        int actualValue;

        TestLibrary.TestFramework.BeginScenario("PosTest2:Create a instance with MaxValue.");
        try
        {
            CompilationRelaxationsAttribute cRA = new CompilationRelaxationsAttribute(expectedValue);
            actualValue = cRA.CompilationRelaxations;

            if (expectedValue != actualValue)
            {
                TestLibrary.TestFramework.LogError("003", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("004", "Unexpected exception:" + e);
            retVal = false;
        }
        return retVal;
    }
    public bool PosTest1()
    {
        bool retVal = true;

        int expectedValue = TestLibrary.Generator.GetInt32(-55);
        int actualValue;

        TestLibrary.TestFramework.BeginScenario("PosTest1:Create a instance with random parameter.");
        try
        {
            CompilationRelaxationsAttribute cRA = new CompilationRelaxationsAttribute(expectedValue);
            actualValue = cRA.CompilationRelaxations;

            if (expectedValue != actualValue)
            {
                TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }

        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e + "when expectedValue is:" + expectedValue);
            retVal = false;
        }
        return retVal;
    }
Exemplo n.º 3
0
    public bool PosTest3()
    {
        bool retVal = true;

        int expectedValue = int.MinValue;
        int actualValue;

        TestLibrary.TestFramework.BeginScenario("PosTest3:Create a instance with MinValue.");
        try
        {
            CompilationRelaxationsAttribute cRA = new CompilationRelaxationsAttribute(expectedValue);
            actualValue = cRA.CompilationRelaxations;

            if (expectedValue != actualValue)
            {
                TestLibrary.TestFramework.LogError("005", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("006", "Unexpected exception:" + e);
            retVal = false;
        }
        return(retVal);
    }
Exemplo n.º 4
0
    public bool PosTest1()
    {
        bool retVal = true;

        int expectedValue = TestLibrary.Generator.GetInt32(-55);
        int actualValue;

        TestLibrary.TestFramework.BeginScenario("PosTest1:Create a instance with random parameter.");
        try
        {
            CompilationRelaxationsAttribute cRA = new CompilationRelaxationsAttribute(expectedValue);
            actualValue = cRA.CompilationRelaxations;

            if (expectedValue != actualValue)
            {
                TestLibrary.TestFramework.LogError("001", "ExpectedValue(" + expectedValue + ") !=ActualValue(" + actualValue + ")");
                retVal = false;
            }
        }
        catch (Exception e)
        {
            TestLibrary.TestFramework.LogError("002", "Unexpected exception:" + e + "when expectedValue is:" + expectedValue);
            retVal = false;
        }
        return(retVal);
    }
Exemplo n.º 5
0
        public static void CompilationRelaxationsAttributeTests()
        {
            var attr1 = new CompilationRelaxationsAttribute(42);

            Assert.Equal(42, attr1.CompilationRelaxations);

            var attr2 = new CompilationRelaxationsAttribute(CompilationRelaxations.NoStringInterning);

            Assert.Equal((int)CompilationRelaxations.NoStringInterning, attr2.CompilationRelaxations);
        }
 public CodeAttributeDeclaration Convert(CompilationRelaxationsAttribute attribute)
 {
     return(new CodeAttributeDeclaration(new CodeTypeReference(attribute.GetType()), new CodeAttributeArgument(new CodePrimitiveExpression(attribute.CompilationRelaxations))));
 }