68 instantiations of TestData
Microsoft.Extensions.AI.Abstractions.Tests (68)
test\Shared\JsonSchemaExporter\TestTypes.cs (68)
50yield return new TestData<bool>(true, """{"type":"boolean"}""");
51yield return new TestData<byte>(42, """{"type":"integer"}""");
52yield return new TestData<ushort>(42, """{"type":"integer"}""");
53yield return new TestData<uint>(42, """{"type":"integer"}""");
54yield return new TestData<ulong>(42, """{"type":"integer"}""");
55yield return new TestData<sbyte>(42, """{"type":"integer"}""");
56yield return new TestData<short>(42, """{"type":"integer"}""");
57yield return new TestData<int>(42, """{"type":"integer"}""");
58yield return new TestData<long>(42, """{"type":"integer"}""");
59yield return new TestData<float>(1.2f, """{"type":"number"}""");
60yield return new TestData<double>(3.14159d, """{"type":"number"}""");
61yield return new TestData<decimal>(3.14159M, """{"type":"number"}""");
63yield return new TestData<UInt128>(42, """{"type":"integer"}""");
64yield return new TestData<Int128>(42, """{"type":"integer"}""");
67yield return new TestData<Half>((Half)3.141, """{"type":"number"}""");
69yield return new TestData<string>("I am a string", """{"type":["string","null"]}""");
70yield return new TestData<char>('c', """{"type":"string","minLength":1,"maxLength":1}""");
76yield return new TestData<Memory<byte>>(new byte[] { 1, 2, 3 }, """{"type":"string"}""");
77yield return new TestData<ReadOnlyMemory<byte>>(new byte[] { 1, 2, 3 }, """{"type":"string"}""");
94yield return new TestData<DateOnly>(new(2021, 1, 1), """{"type":"string","format": "date"}""");
95yield return new TestData<TimeOnly>(new(hour: 22, minute: 30, second: 33, millisecond: 100), """{"type":"string","format": "time"}""");
97yield return new TestData<Guid>(Guid.Empty, """{"type":"string","format":"uuid"}""");
98yield return new TestData<Uri>(new("http://example.com"), """{"type":["string","null"], "format":"uri"}""");
99yield return new TestData<Version>(new(1, 2, 3, 4), """{"$comment":"Represents a version string.", "type":["string","null"],"pattern":"^\\d+(\\.\\d+){1,3}$"}""");
100yield return new TestData<JsonDocument>(JsonDocument.Parse("""[{ "x" : 42 }]"""), "true");
101yield return new TestData<JsonElement>(JsonDocument.Parse("""[{ "x" : 42 }]""").RootElement, "true");
102yield return new TestData<JsonNode>(JsonNode.Parse("""[{ "x" : 42 }]"""), "true");
103yield return new TestData<JsonValue>((JsonValue)42, "true");
104yield return new TestData<JsonObject>(new() { ["x"] = 42 }, """{"type":["object","null"]}""");
108yield return new TestData<IntEnum>(IntEnum.A, """{"type":"integer"}""");
109yield return new TestData<StringEnum>(StringEnum.A, """{"enum": ["A","B","C"]}""");
110yield return new TestData<FlagsStringEnum>(FlagsStringEnum.A, """{"type":"string"}""");
113yield return new TestData<bool?>(true, """{"type":["boolean","null"]}""");
114yield return new TestData<int?>(42, """{"type":["integer","null"]}""");
115yield return new TestData<double?>(3.14, """{"type":["number","null"]}""");
116yield return new TestData<Guid?>(Guid.Empty, """{"type":["string","null"],"format":"uuid"}""");
117yield return new TestData<JsonElement?>(JsonDocument.Parse("{}").RootElement, "true");
118yield return new TestData<IntEnum?>(IntEnum.A, """{"type":["integer","null"]}""");
119yield return new TestData<StringEnum?>(StringEnum.A, """{"enum":["A","B","C",null]}""");
120yield return new TestData<SimpleRecordStruct?>(
169yield return new TestData<SimpleRecord>(
184yield return new TestData<SimpleRecordStruct>(
198yield return new TestData<RecordWithOptionalParameters>(
219yield return new TestData<PocoWithRequiredMembers>(
233yield return new TestData<PocoWithIgnoredMembers>(
243yield return new TestData<PocoWithCustomNaming>(
255yield return new TestData<PocoWithCustomNumberHandling>(
331yield return new TestData<PocoWithNonRecursiveDuplicateOccurrences>(
387yield return new TestData<PocoWithDescription>(
400yield return new TestData<PocoWithCustomConverter>(new() { Value = 42 }, "true");
401yield return new TestData<PocoWithCustomPropertyConverter>(new() { Value = 42 }, """{"type":["object","null"],"properties":{"Value":true}}""");
496yield return new TestData<PocoWithExtensionDataProperty>(
500yield return new TestData<PocoDisallowingUnmappedMembers>(
532yield return new TestData<PocoWithNullableAnnotationAttributes>(
547yield return new TestData<PocoWithNullableAnnotationAttributesOnConstructorParams>(
560yield return new TestData<PocoWithNullableConstructorParameter>(
572yield return new TestData<PocoWithOptionalConstructorParams>(
592yield return new TestData<GenericPocoWithNullableConstructorParameter<string>>(
683yield return new TestData<PocoCombiningPolymorphicTypeAndDerivedTypes>(
758yield return new TestData<ClassWithComponentModelAttributes>(
799yield return new TestData<ImmutableArray<int>>(ImmutableArray.Create(1, 2, 3), """{"type":"array","items":{"type":"integer"}}""");
800yield return new TestData<ImmutableList<string>>(ImmutableList.Create("one", "two", "three"), """{"type":["array","null"],"items":{"type":["string","null"]}}""");
801yield return new TestData<ImmutableQueue<bool>>(ImmutableQueue.Create(false, false, true), """{"type":["array","null"],"items":{"type":"boolean"}}""");
806yield return new TestData<Dictionary<string, int>>(
814yield return new TestData<SortedDictionary<int, string>>(
818yield return new TestData<Dictionary<string, SimplePoco>>(
841yield return new TestData<Dictionary<string, object>>(
845yield return new TestData<Hashtable>(