Пример #1
0
        public void CheckValue_Single()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);
            var fieldEntity   = new PropertyEntity(expression, this, GetPropertyByName("Single"));
            var result        = fieldEntity.ToString();

            Assert.Equal("Single: 3.40282346638529E+38", result);
        }
Пример #2
0
        public void CheckValue_Char()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);
            var fieldEntity   = new PropertyEntity(expression, this, GetPropertyByName("Char"));
            var result        = fieldEntity.ToString();

            Assert.Equal("Char: Ê", result);
        }
Пример #3
0
        public void CheckValue_Decimal()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);
            var fieldEntity   = new PropertyEntity(expression, this, GetPropertyByName("Decimal"));
            var result        = fieldEntity.ToString();

            Assert.Equal("Decimal: -79228162514264337593543950335", result);
        }
Пример #4
0
        public void CheckValue_IntPtr()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);
            var fieldEntity   = new PropertyEntity(expression, this, GetPropertyByName("IntPtr"));
            var result        = fieldEntity.ToString();

            Assert.Equal("IntPtr: 9223372036854775807", result);
        }
Пример #5
0
        public void CheckValue_UInt64()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);
            var fieldEntity   = new PropertyEntity(expression, this, GetPropertyByName("UInt64"));
            var result        = fieldEntity.ToString();

            Assert.Equal("UInt64: 18446744073709551615", result);
        }
Пример #6
0
        public void CheckValue_DateTimeOffset()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);
            var fieldEntity   = new PropertyEntity(expression, this, GetPropertyByName("DateTimeOffset"));
            var result        = fieldEntity.ToString();

            Assert.Equal("DateTimeOffset: 2000-01-01T00:00:00.000+00:00", result);
        }
Пример #7
0
        public void ValueString_Normal()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);
            var prop1Complex  = new PropertyEntity(expression, this, GetPropertyByName("PropString"));
            var result        = prop1Complex.ToString();

            Assert.Equal("PropString: abc \" def \"ghi\"", result);
        }
Пример #8
0
        public void Property()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);
            var prop1Complex  = new PropertyEntity(expression, this, GetPropertyByName("PropInt"));
            var result        = prop1Complex.ToString();

            Assert.Equal("PropInt: 100", result);
        }
Пример #9
0
        public void ShowTypeOnlyName()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);

            serialization.ShowType = ShowTypeOptions.TypeName;
            var prop1Complex = new PropertyEntity(expression, this, GetPropertyByName("PropInt"));
            var result       = prop1Complex.ToString();

            Assert.Equal("Int32.PropInt: 100", result);
        }
Пример #10
0
        public void ValueString_TruncateValue2()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);

            serialization.ValueFormatter = new TruncateFormatter(3);
            var prop1Complex = new PropertyEntity(expression, this, GetPropertyByName("PropString"));
            var result       = prop1Complex.ToString();

            Assert.Equal("PropString: abc", result);
        }
Пример #11
0
        public void ValueString_Null_Parent_WithoutType()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);

            serialization.ShowType = ShowTypeOptions.None;

            this.PropString = null;
            var prop1Complex = new PropertyEntity(expression, null, GetPropertyByName("PropString"));
            var result       = prop1Complex.ToString();

            Assert.Equal("PropString", result);
        }
Пример #12
0
        public void CheckValue_CharNullable()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);

            serialization.ShowType = ShowTypeOptions.TypeName;

            var fieldEntity = new PropertyEntity(expression, this, GetPropertyByName("CharNullable"));
            var result      = fieldEntity.ToString();

            Assert.Equal("Nullable`1.CharNullable: Ê", result);

            serialization.ShowType = ShowTypeOptions.None;
            CharNullable           = null;
            fieldEntity            = new PropertyEntity(expression, this, GetPropertyByName("CharNullable"));
            result = fieldEntity.ToString();
            Assert.Equal("CharNullable", result);
        }
Пример #13
0
        public void CheckValue_DecimalNullable()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);

            serialization.ShowType = ShowTypeOptions.TypeName;

            var fieldEntity = new PropertyEntity(expression, this, GetPropertyByName("DecimalNullable"));
            var result      = fieldEntity.ToString();

            Assert.Equal("Nullable`1.DecimalNullable: -398131469920926319565547489.12", result);

            serialization.ShowType = ShowTypeOptions.None;
            DecimalNullable        = null;
            fieldEntity            = new PropertyEntity(expression, this, GetPropertyByName("DecimalNullable"));
            result = fieldEntity.ToString();
            Assert.Equal("DecimalNullable", result);
        }
Пример #14
0
        public void CheckValue_DateTimeOffsetNullable()
        {
            var expression    = Utils.CreateEmptyExpression();
            var serialization = Utils.GetSerialization(expression);

            serialization.ShowType = ShowTypeOptions.TypeName;

            var fieldEntity = new PropertyEntity(expression, this, GetPropertyByName("DateTimeOffsetNullable"));
            var result      = fieldEntity.ToString();

            Assert.Equal("Nullable`1.DateTimeOffsetNullable: 2000-01-01T00:00:00.000+00:00", result);

            serialization.ShowType = ShowTypeOptions.None;
            DateTimeOffsetNullable = null;
            fieldEntity            = new PropertyEntity(expression, this, GetPropertyByName("DateTimeOffsetNullable"));
            result = fieldEntity.ToString();
            Assert.Equal("DateTimeOffsetNullable", result);
        }