Beispiel #1
0
        public void Params_NonBlittable()
        {
            NonBlittable a = new NonBlittable(false, 'X', "WinRT", (long?)PropertyValue.CreateInt64(1234));
            NonBlittable b;
            NonBlittable c = Tests.Param14(a, in a, out b);

            Assert.True(AllEqual(a, b, c));
        }
Beispiel #2
0
        public void Params_Nested()
        {
            Nested a = new Nested(
                new Blittable(1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, typeof(ITests).GUID),
                new NonBlittable(false, 'X', "WinRT", (long?)PropertyValue.CreateInt64(1234)));
            Nested b;
            Nested c = Tests.Param15(a, in a, out b);

            Assert.True(AllEqual(a, b, c));
        }
 public void Array_NonBlittable()
 {
     NonBlittable[] a = new NonBlittable[] {
         new NonBlittable(false, 'X', "First", (long?)PropertyValue.CreateInt64(123)),
         new NonBlittable(true, 'Y', "Second", (long?)PropertyValue.CreateInt64(456)),
         new NonBlittable(false, 'Z', "Third", (long?)PropertyValue.CreateInt64(789))
     };
     NonBlittable[] b = new NonBlittable[a.Length];
     NonBlittable[] c;
     NonBlittable[] d = Tests.Array14(a, b, out c);
     Assert.True(AllEqual(a, b, c, d));
 }
 public void Array_Nested()
 {
     Nested[] a = new Nested[] {
         new Nested(
             new Blittable(1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, typeof(ITests).GUID),
             new NonBlittable(false, 'X', "First", (long?)PropertyValue.CreateInt64(123))),
         new Nested(
             new Blittable(10, 20, 30, 40, -50, -60, -70, 80.0f, 90.0, typeof(IStringable).GUID),
             new NonBlittable(true, 'Y', "Second", (long?)PropertyValue.CreateInt64(456))),
         new Nested(
             new Blittable(1, 2, 3, 4, -5, -6, -7, 8.0f, 9.0, typeof(IInspectable).GUID),
             new NonBlittable(false, 'Z', "Third", (long?)PropertyValue.CreateInt64(789)))
     };
     Nested[] b = new Nested[a.Length];
     Nested[] c;
     Nested[] d = Tests.Array15(a, b, out c);
     Assert.True(AllEqual(a, b, c, d));
 }
Beispiel #5
0
        public static object Parse(AppDataType.Type type, string s)
        {
            object obj = null;

            switch (type)
            {
            case AppDataType.Type.Empty: obj = PropertyValue.CreateEmpty();; break;

            case AppDataType.Type.UInt8: obj = PropertyValue.CreateUInt8(s.IsEmpty() ? (byte)0 : Byte.Parse(s)); break;

            case AppDataType.Type.Int16: obj = PropertyValue.CreateInt16(s.IsEmpty() ? (short)0 : Int16.Parse(s)); break;

            case AppDataType.Type.UInt16: obj = PropertyValue.CreateUInt16(s.IsEmpty() ? (ushort)0 : UInt16.Parse(s)); break;

            case AppDataType.Type.Int32: obj = PropertyValue.CreateInt32(s.IsEmpty() ? 0 : Int32.Parse(s)); break;

            case AppDataType.Type.UInt32: obj = PropertyValue.CreateUInt32(s.IsEmpty() ? 0 : UInt32.Parse(s)); break;

            case AppDataType.Type.Int64: obj = PropertyValue.CreateInt64(s.IsEmpty() ? 0 : Int64.Parse(s)); break;

            case AppDataType.Type.UInt64: obj = PropertyValue.CreateUInt64(s.IsEmpty() ? 0 : UInt64.Parse(s)); break;

            case AppDataType.Type.Single: obj = PropertyValue.CreateSingle(s.IsEmpty() ? 0 : Single.Parse(s)); break;

            case AppDataType.Type.Double: obj = PropertyValue.CreateDouble(s.IsEmpty() ? 0 : Double.Parse(s)); break;

            case AppDataType.Type.Char16: obj = PropertyValue.CreateChar16(Char.Parse(s)); break;

            case AppDataType.Type.Boolean: obj = PropertyValue.CreateBoolean(s.IsEmpty() ? false : Boolean.Parse(s)); break;

            case AppDataType.Type.String: obj = s; break;

            default: break;
            }
            return(obj);
        }