コード例 #1
0
ファイル: DataTreeTest.cs プロジェクト: Bloodpearl/Utils
        public bool test_Value_TypeOF(out string message)
        {
            message = "";

            int      structValue = 5;
            DataLeaf leaf        = new DataLeaf(typeof(int));

            try
            {
                leaf.Value = structValue;
                if ((int)leaf.Value != structValue)
                {
                    message = "Leaf returns wrong value (struct)";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                message = "Cannot put into leaf struct value\n" + ex.Message;
                return(false);
            }

            DataLeafTest value = new DataLeafTest();

            leaf = new DataLeaf(typeof(DataLeafTest));
            try
            {
                leaf.Value = value;
                if ((DataLeafTest)leaf.Value != value)
                {
                    message = "Leaf returns wrong value (struct)";
                    return(false);
                }
            }
            catch (Exception ex)
            {
                message = "Cannot put into leaf struct value\n" + ex.Message;
                return(false);
            }

            return(true);
        }
コード例 #2
0
ファイル: DataTreeTest.cs プロジェクト: Bloodpearl/Utils
        public bool test_Value_TypeOF(out string message)
        {
            message = "";

            int structValue = 5;
            DataLeaf leaf = new DataLeaf(typeof(int));
            try
            {
                leaf.Value = structValue;
                if ((int)leaf.Value != structValue)
                {
                    message = "Leaf returns wrong value (struct)";
                    return false;
                }
            }
            catch (Exception ex)
            {
                message = "Cannot put into leaf struct value\n" + ex.Message;
                return false;
            }

            DataLeafTest value = new DataLeafTest();
            leaf = new DataLeaf(typeof(DataLeafTest));
            try
            {
                leaf.Value = value;
                if ((DataLeafTest)leaf.Value != value)
                {
                    message = "Leaf returns wrong value (struct)";
                    return false;
                }
            }
            catch (Exception ex)
            {
                message = "Cannot put into leaf struct value\n" + ex.Message;
                return false;
            }

            return true;
        }