Example #1
0
    private static void TestProperty(NeedsTesting target, PropertyInfo property)
    {
        bool result;

        property.SetValue(target, true);
        result = (bool)property.GetValue(target);
        VerifyEquals(result, true, string.Format("Property '{0}' failed to retain a 'true' value.", property.Name));
        property.SetValue(target, false);
        result = (bool)property.GetValue(target);
        VerifyEquals(result, false, string.Format("Property '{0}' failed to retain a 'false' value.", property.Name));
    }
Example #2
0
    private static void DoTest(NeedsTesting target)
    {
        Type type = typeof(NeedsTesting);

        PropertyInfo[] properties;
        int            count = 0;

        properties = type.GetProperties();
        foreach (PropertyInfo property in properties)
        {
            if (property.Name.StartsWith("Group"))
            {
                count++;
                TestProperty(target, property);
            }
        }
        if (count != 5)
        {
            VerifyEquals(false, true, "Did not find all 5 properties to test");
        }
    }
Example #3
0
    static void Main()
    {
        NeedsTesting target = new NeedsTesting();

        DoTest(target);
    }