public static IEnumerable TestData()

in firestore/testapp/Assets/Firebase/Sample/Firestore/SerializationTestData.cs [77:245]


    public static IEnumerable<TestCase> TestData(FirebaseFirestore database) {
      return new List<TestCase> {
        // Simple types
        { new TestCase(null, null) },
        { new TestCase(true, true) },
        { new TestCase(false, false) },
        { new TestCase("test", "test") },
        { new TestCase((byte)1, 1L) },
        { new TestCase((sbyte)1, 1L) },
        { new TestCase((short)1, 1L) },
        { new TestCase((ushort)1, 1L) },
        { new TestCase(1, 1L) },
        { new TestCase(1U, 1L) },
        { new TestCase(1L, 1L) },
        { new TestCase(1UL, 1L) },
        { new TestCase(1.5F, 1.5D) },
        { new TestCase(float.PositiveInfinity, double.PositiveInfinity) },
        { new TestCase(float.NegativeInfinity, double.NegativeInfinity) },
        { new TestCase(float.NaN, double.NaN) },
        { new TestCase(1.5D, 1.5D) },
        { new TestCase(double.PositiveInfinity, double.PositiveInfinity) },
        { new TestCase(double.NegativeInfinity, double.NegativeInfinity) },
        { new TestCase(double.NaN, double.NaN) },

        // Min/max values of each integer type
        { new TestCase(byte.MinValue, (long)byte.MinValue) },
        { new TestCase(byte.MaxValue, (long)byte.MaxValue) },
        { new TestCase(sbyte.MinValue, (long)sbyte.MinValue) },
        { new TestCase(sbyte.MaxValue, (long)sbyte.MaxValue) },
        { new TestCase(short.MinValue, (long)short.MinValue) },
        { new TestCase(short.MaxValue, (long)short.MaxValue) },
        { new TestCase(ushort.MinValue, (long)ushort.MinValue) },
        { new TestCase(ushort.MaxValue, (long)ushort.MaxValue) },
        { new TestCase(int.MinValue, (long)int.MinValue) },
        { new TestCase(int.MaxValue, (long)int.MaxValue) },
        { new TestCase(uint.MinValue, (long)uint.MinValue) },
        { new TestCase(uint.MaxValue, (long)uint.MaxValue) },
        { new TestCase(long.MinValue, long.MinValue) },
        { new TestCase(long.MaxValue, long.MaxValue) },
        // We don't cover the whole range of ulong
        { new TestCase((ulong)0, 0L) },
        { new TestCase((ulong) long.MaxValue, long.MaxValue) },

        // Enum types
        { new TestCase(ByteEnum.MinValue, (long)byte.MinValue) },
        { new TestCase(ByteEnum.MaxValue, (long)byte.MaxValue) },
        { new TestCase(SByteEnum.MinValue, (long)sbyte.MinValue) },
        { new TestCase(SByteEnum.MaxValue, (long)sbyte.MaxValue) },
        { new TestCase(Int16Enum.MinValue, (long)short.MinValue) },
        { new TestCase(Int16Enum.MaxValue, (long)short.MaxValue) },
        { new TestCase(UInt16Enum.MinValue, (long)ushort.MinValue) },
        { new TestCase(UInt16Enum.MaxValue, (long)ushort.MaxValue) },
        { new TestCase(Int32Enum.MinValue, (long)int.MinValue) },
        { new TestCase(Int32Enum.MaxValue, (long)int.MaxValue) },
        { new TestCase(UInt32Enum.MinValue, (long)uint.MinValue) },
        { new TestCase(UInt32Enum.MaxValue, (long)uint.MaxValue) },
        { new TestCase(Int64Enum.MinValue, (long)long.MinValue) },
        { new TestCase(Int64Enum.MaxValue, (long)long.MaxValue) },
        // We don't cover the whole range of ulong
        { new TestCase(UInt64Enum.MinValue, (long)0) },
        { new TestCase(UInt64Enum.MaxRepresentableValue, (long)long.MaxValue) },
        { new TestCase(CustomConversionEnum.Foo, "Foo") },
        { new TestCase(CustomConversionEnum.Bar, "Bar") },

        // Timestamps
        { new TestCase(Timestamp.FromDateTime(dateTime), Timestamp.FromDateTime(dateTime)) },
        { new TestCase(dateTime, Timestamp.FromDateTime(dateTime)) },
        { new TestCase(dateTimeOffset, Timestamp.FromDateTimeOffset(dateTimeOffset)) },

        // Blobs
        { new TestCase(new byte[] { 1, 2, 3, 4 }, Blob.CopyFrom(new byte[] { 1, 2, 3, 4 })) },
        { new TestCase(Blob.CopyFrom(new byte[] { 1, 2, 3, 4 }),
                       Blob.CopyFrom(new byte[] { 1, 2, 3, 4 })) },

        // GeoPoints
        { new TestCase(new GeoPoint(1.5, 2.5), new GeoPoint(1.5, 2.5)) },

        // Array values
        { new TestCase(new string[] { "x", "y" }, new List<object> { "x", "y" }) },
        { new TestCase(new List<string> { "x", "y" }, new List<object> { "x", "y" }) },
        { new TestCase(new int[] { 3, 4 }, new List<object> { 3L, 4L }) },

        // Deliberately DateTime rather than Timestamp here - we need to be able to detect the
        // element type to perform the per-element deserialization correctly
        { new TestCase(new List<DateTime> { dateTime, dateTime },
                       new List<object> { Timestamp.FromDateTime(dateTime),
                                          Timestamp.FromDateTime(dateTime) }) },

        // Map values (that can be deserialized again): dictionaries, attributed types, expandos
        // (which are just dictionaries), custom serialized map-like values

        // Dictionaries
        { new TestCase(new Dictionary<string, byte> { { "A", 10 }, { "B", 20 } },
                       new Dictionary<string, object> { { "A", 10L }, { "B", 20L } }) },
        { new TestCase(new Dictionary<string, int> { { "A", 10 }, { "B", 20 } },
                       new Dictionary<string, object> { { "A", 10L }, { "B", 20L } }) },
        { new TestCase(new Dictionary<string, object> { { "name", "Jon" }, { "score", 10L } },
                       new Dictionary<string, object> { { "name", "Jon" }, { "score", 10L } }) },
        // Attributed type (each property has an attribute)
        { new TestCase(new GameResult { Name = "Jon", Score = 10 },
                       new Dictionary<string, object> { { "name", "Jon" }, { "Score", 10L } }) },
        // Attributed type contained in a dictionary
        { new TestCase(
            new Dictionary<string, GameResult> { { "result",
                                                   new GameResult { Name = "Jon", Score = 10 } } },
            new Dictionary<string, object> {
              { "result", new Dictionary<string, object> { { "name", "Jon" }, { "Score", 10L } } }
            }) },
        // Attributed type containing a dictionary
        { new TestCase(
            new DictionaryInterfaceContainer {
              Integers = new Dictionary<string, int> { { "A", 10 }, { "B", 20 } }
            },
            new Dictionary<string, object> {
              { "Integers", new Dictionary<string, object> { { "A", 10L }, { "B", 20L } } }
            }) },
        // Attributed type serialized and deserialized by CustomPlayerConverter
        { new TestCase(new CustomPlayer { Name = "Amanda", Score = 15 },
                       new Dictionary<string, object> { { "PlayerName", "Amanda" },
                                                        { "PlayerScore", 15L } }) },

        // Attributed value type serialized and deserialized by CustomValueTypeConverter
        { new TestCase(new CustomValueType("xyz", 10),
                       new Dictionary<string, object> { { "Name", "xyz" }, { "Value", 10L } }) },

        // Attributed type with enums (name and number)
        { new TestCase(new ModelWithEnums { EnumDefaultByName = CustomConversionEnum.Foo,
                                            EnumAttributedByName = Int32Enum.MinValue,
                                            EnumByNumber = Int32Enum.MaxValue },
                       new Dictionary<string, object> { { "EnumDefaultByName", "Foo" },
                                                        { "EnumAttributedByName", "MinValue" },
                                                        { "EnumByNumber", (long)int.MaxValue } }) },

        // Attributed type with List field
        { new TestCase(new CustomUser { Name = "Jon", HighScore = 10,
                                        Emails = new List<string> { "jon@example.com" } },
                       new Dictionary<string, object> {
                         { "Name", "Jon" },
                         { "HighScore", 10L },
                         { "Emails", new List<object> { "jon@example.com" } }
                       }) },

        // Attributed type with IEnumerable field
        { new TestCase(
            new CustomUserEnumerableEmails() { Name = "Jon", HighScore = 10,
                                               Emails = new List<string> { "jon@example.com" } },
            new Dictionary<string, object> { { "Name", "Jon" },
                                             { "HighScore", 10L },
                                             { "Emails",
                                               new List<object> { "jon@example.com" } } }) },

        // Attributed type with Set field and custom converter.
        { new TestCase(
            new CustomUserSetEmailsWithConverter() {
              Name = "Jon", HighScore = 10, Emails = new HashSet<string> { "jon@example.com" }
            },
            new Dictionary<string, object> { { "Name", "Jon" },
                                             { "HighScore", 10L },
                                             { "Emails",
                                               new List<object> { "jon@example.com" } } }) },

        // Attributed struct
        { new TestCase(new StructModel { Name = "xyz", Value = 10 },
                       new Dictionary<string, object> { { "Name", "xyz" }, { "Value", 10L } }) },

        // Document references
        { new TestCase(database.Document("a/b"), database.Document("a/b")) },
      };
    }