public void AotGcMemmove_Crash_17284()
        {
            var arr = new AnEnum [16];
            var c   = new ReadOnlyCollection <AnEnum> (arr);

            Assert.False(c.Contains(AnEnum.First));
        }
示例#2
0
    public static int test_0_unbox_any_enum()
    {
        IFaceUnbox iface = new ClassUnbox();
        AnEnum     res   = iface.Unbox <AnEnum, int> (AnEnum.One, 0, 1);

        return(res == AnEnum.Two ? 0 : 1);
    }
示例#3
0
    public static int test_0_array_helper_gsharedvt()
    {
        var arr = new AnEnum [16];
        var c   = new ReadOnlyCollection <AnEnum> (arr);

        return(c.Contains(AnEnum.Two) == false ? 0 : 1);
    }
示例#4
0
 public void Compare(AnEnum inputEnum)
 {
     if (inputEnum == AnEnum.Three)
     {
         Console.WriteLine("Match.");
     }
     else
     {
         Console.WriteLine("Fail match.");
     }
 }
示例#5
0
        public void TestArray()
        {
            var a    = new AnEnum[] { AnEnum.Test3, AnEnum.Test1 };
            var json = new JsonSerializer().Serialize(a);

            Assert.That(json, Is.EqualTo(@"[""Test3"",""Test1""]"));
            Assert.That(new JsonSerializer().Deserialize <AnEnum[]>(json), Is.EqualTo(a));
            var a2 = new JsonSerializer().Deserialize <AnEnum[]>("[4,1]");

            Assert.That(a2, Is.EquivalentTo(a));
        }
示例#6
0
        public void LiteralReplacementEnumAndString()
        {
            var         args = new { x = AnEnum.B, y = 123.45M, z = AnotherEnum.A };
            var         row  = connection.Query("select {=x} as x,{=y} as y,cast({=z} as tinyint) as z", args).Single();
            AnEnum      x    = (AnEnum)(int)row.x;
            decimal     y    = row.y;
            AnotherEnum z    = (AnotherEnum)(byte)row.z;

            x.Equals(AnEnum.B);
            y.Equals(123.45M);
            z.Equals(AnotherEnum.A);
        }
示例#7
0
 public ComplexClass(
     bool?nullableBool,
     AnEnum anEnum,
     double?nullableDouble,
     int?nullableInt,
     float aFloat,
     float?nullableFloat,
     bool aBool,
     Dictionary <string, string> simpleDict,
     Dictionary <int?, DateTime> nullableIntKeyedDateTimeDict,
     double[] doubleArray,
     List <bool> boolList,
     Dictionary <string, List <(int, ComplexClass)> > children,
        public void Create_Enum_CanConvert()
        {
            // Act
            IConverter <EntityProperty, AnEnum> converter = EntityPropertyToTConverterFactory.Create <AnEnum>();

            // Assert
            Assert.NotNull(converter);
            const AnEnum   expected = AnEnum.B;
            EntityProperty property = new EntityProperty(expected.ToString());
            AnEnum         actual   = converter.Convert(property);

            Assert.AreEqual(expected, actual);
        }
示例#9
0
        public void Create_NullableEnum_CanConvert()
        {
            // Act
            IConverter <AnEnum?, EntityProperty> converter = TToEntityPropertyConverterFactory.Create <AnEnum?>();

            // Assert
            Assert.NotNull(converter);
            const AnEnum   expectedValue = AnEnum.B;
            EntityProperty property      = converter.Convert(expectedValue);

            Assert.NotNull(property);
            Assert.Equal(EdmType.String, property.PropertyType);
            Assert.Equal(expectedValue.ToString(), property.StringValue);
        }
示例#10
0
 public void AdoNetEnumValue()
 {
     using (var cmd = connection.CreateCommand())
     {
         cmd.CommandText = "select @foo";
         var p = cmd.CreateParameter();
         p.ParameterName = "@foo";
         p.DbType        = DbType.Int32; // it turns out that this is the key piece; setting the DbType
         p.Value         = AnEnum.B;
         cmd.Parameters.Add(p);
         object value = cmd.ExecuteScalar();
         AnEnum val   = (AnEnum)value;
         Assert.Equal(AnEnum.B, val);
     }
 }
示例#11
0
        public void LiteralReplacementDynamicEnumAndString()
        {
            var args = new DynamicParameters();

            args.Add("x", AnEnum.B);
            args.Add("y", 123.45M);
            args.Add("z", AnotherEnum.A);
            var         row = connection.Query("select {=x} as x,{=y} as y,cast({=z} as tinyint) as z", args).Single();
            AnEnum      x   = (AnEnum)(int)row.x;
            decimal     y   = row.y;
            AnotherEnum z   = (AnotherEnum)(byte)row.z;

            x.Equals(AnEnum.B);
            y.Equals(123.45M);
            z.Equals(AnotherEnum.A);
        }
示例#12
0
文件: gshared.cs 项目: ztone/mono
    public static int test_0_unbox_any_enum()
    {
        IFaceUnbox iface = new ClassUnbox();
        AnEnum     res   = iface.Unbox <AnEnum, int> (AnEnum.One, 0, 1);

        if (res != AnEnum.Two)
        {
            return(1);
        }
        res = iface.Unbox <AnEnum, int> (AnEnum.One, 0, AnEnum.Two);
        if (res != AnEnum.Two)
        {
            return(2);
        }
        return(0);
    }
示例#13
0
        private void UseEnumFromOtherFileInSolution(AnEnum m)
        {
            var nothing = Enumerable.Empty <string>().ToArray()[(int)AnEnum.AnEnumMember];

            switch (m)
            {
            case -1:
            {
                return;
            }

            case AnEnum.AnEnumMember:
            {
                return;
            }
            }
        }
示例#14
0
 public ComplexData(AnEnum va, object[] info)
 {
     Info = info;
     Val  = va;
 }
示例#15
0
 public EntityBaseBase(int id, string name, AnEnum anEnum)
 {
     Id     = id;
     Name   = name;
     AnEnum = anEnum;
 }
示例#16
0
 public void SetAnEnum(AnEnum anEnum)
 {
     AnEnum = anEnum;
 }
示例#17
0
        /// <inheritdoc />
        public virtual Task <HttpResponseMessage> UploadMixedObjects(IEnumerable <ModelObject> theObjects, AnotherModel anotherModel, FileInfo aFile, AnEnum anEnum, string aString, int anInt)
        {
            var arguments = new object[] { theObjects, anotherModel, aFile, anEnum, aString, anInt };
            var func      = requestBuilder.BuildRestResultFuncForMethod("UploadMixedObjects", new Type[] { typeof(IEnumerable <ModelObject>), typeof(AnotherModel), typeof(FileInfo), typeof(AnEnum), typeof(string), typeof(int) });

            return((Task <HttpResponseMessage>)func(Client, arguments));
        }
		public ComplexData (AnEnum va, object[] info)
		{
			Info = info;
			Val = va;
		}
示例#19
0
 public ActualEntity1(int id, string name, AnEnum anEnum, ActualComplex info, ICollection <ActualEntity2> colRel)
     : base(id, name, anEnum, info, colRel)
 {
 }
示例#20
0
 public ParentObject(AnEnum parentEnum, ChildObject child)
 {
     ParentEnum = parentEnum;
     Child      = child;
 }
示例#21
0
 public EntityBase1(int id, string name, AnEnum anEnum, ActualComplex info, ICollection <ActualEntity2> colRel)
     : base(id, name, anEnum)
 {
     Info   = info;
     ColRel = colRel;
 }
示例#22
0
 public EntityBase2(int id, string name, AnEnum anEnum, int refRelId, ActualEntity1 refRel)
     : base(id, name, anEnum)
 {
     RefRelId = refRelId;
     RefRel   = refRel;
 }
		public ParentObject(AnEnum parentEnum, ChildObject child, List<ChildObject> children)
		{
			ParentEnum = parentEnum;
			Child = child;
			Children = children;
		}
示例#24
0
 public ChildObject(AnEnum childEnum, int number)
 {
     ChildEnum = childEnum;
     Number    = number;
 }
示例#25
0
 public static unsafe string ti2(string[] s2, int[] s3, int[,] s4, ref int ri, int *ptr, int i, AStruct s, Tests t, Tests2 t2, GClass <int> g, AnEnum ae)
 {
     return(s2 [0] + s3 [0] + s4 [0, 0]);
 }
示例#26
0
 public ActualEntity2(int id, string name, AnEnum anEnum, int refRelId, ActualEntity1 refRel)
     : base(id, name, anEnum, refRelId, refRel)
 {
 }