23 references to ConvertPrimitive
Aspire.Hosting.RemoteHost (2)
Ats\AtsMarshaller.cs (2)
579return node is JsonValue value ? ConvertPrimitive(value, targetType) : node; 617return ConvertPrimitive(value, targetType);
Aspire.Hosting.RemoteHost.Tests (21)
AtsMarshallerTests.cs (21)
243var result = AtsMarshaller.ConvertPrimitive(value!, typeof(string)); 253var result = AtsMarshaller.ConvertPrimitive(value!, typeof(int)); 263var result = AtsMarshaller.ConvertPrimitive(value!, typeof(int)); 273Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value!, typeof(int))); 280var result = AtsMarshaller.ConvertPrimitive(value, targetType); 289Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value, targetType)); 296Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value, targetType)); 304var result = AtsMarshaller.ConvertPrimitive(value!, typeof(bool)); 314var result = AtsMarshaller.ConvertPrimitive(value!, typeof(TimeSpan)); 324var result = AtsMarshaller.ConvertPrimitive(value!, typeof(int?)); 469var result = AtsMarshaller.ConvertPrimitive(value!, typeof(DateOnly)); 492var result = AtsMarshaller.ConvertPrimitive(value!, typeof(TimeOnly)); 589var result = AtsMarshaller.ConvertPrimitive(value!, typeof(long)); 599var result = AtsMarshaller.ConvertPrimitive(value!, typeof(long)); 609Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value!, typeof(long))); 617var result = AtsMarshaller.ConvertPrimitive(value!, typeof(double)); 627var result = AtsMarshaller.ConvertPrimitive(value!, typeof(double)); 637var result = AtsMarshaller.ConvertPrimitive(value!, typeof(float)); 647var result = AtsMarshaller.ConvertPrimitive(value!, typeof(decimal)); 657Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value!, typeof(decimal))); 665var result = AtsMarshaller.ConvertPrimitive(value!, typeof(TimeSpan));