public void AotGcMemmove_Crash_17284() { var arr = new AnEnum [16]; var c = new ReadOnlyCollection <AnEnum> (arr); Assert.False(c.Contains(AnEnum.First)); }
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); }
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); }
public void Compare(AnEnum inputEnum) { if (inputEnum == AnEnum.Three) { Console.WriteLine("Match."); } else { Console.WriteLine("Fail match."); } }
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)); }
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); }
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); }
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); }
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); } }
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); }
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); }
private void UseEnumFromOtherFileInSolution(AnEnum m) { var nothing = Enumerable.Empty <string>().ToArray()[(int)AnEnum.AnEnumMember]; switch (m) { case -1: { return; } case AnEnum.AnEnumMember: { return; } } }
public ComplexData(AnEnum va, object[] info) { Info = info; Val = va; }
public EntityBaseBase(int id, string name, AnEnum anEnum) { Id = id; Name = name; AnEnum = anEnum; }
public void SetAnEnum(AnEnum anEnum) { AnEnum = anEnum; }
/// <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; }
public ActualEntity1(int id, string name, AnEnum anEnum, ActualComplex info, ICollection <ActualEntity2> colRel) : base(id, name, anEnum, info, colRel) { }
public ParentObject(AnEnum parentEnum, ChildObject child) { ParentEnum = parentEnum; Child = child; }
public EntityBase1(int id, string name, AnEnum anEnum, ActualComplex info, ICollection <ActualEntity2> colRel) : base(id, name, anEnum) { Info = info; ColRel = colRel; }
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; }
public ChildObject(AnEnum childEnum, int number) { ChildEnum = childEnum; Number = number; }
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]); }
public ActualEntity2(int id, string name, AnEnum anEnum, int refRelId, ActualEntity1 refRel) : base(id, name, anEnum, refRelId, refRel) { }