23 references to ConvertPrimitive
Aspire.Hosting.RemoteHost (2)
Ats\AtsMarshaller.cs (2)
599return node is JsonValue value ? ConvertPrimitive(value, targetType) : node; 637return ConvertPrimitive(value, targetType);
Aspire.Hosting.RemoteHost.Tests (21)
AtsMarshallerTests.cs (21)
311var result = AtsMarshaller.ConvertPrimitive(value!, typeof(string)); 321var result = AtsMarshaller.ConvertPrimitive(value!, typeof(int)); 331var result = AtsMarshaller.ConvertPrimitive(value!, typeof(int)); 341Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value!, typeof(int))); 348var result = AtsMarshaller.ConvertPrimitive(value, targetType); 357Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value, targetType)); 364Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value, targetType)); 372var result = AtsMarshaller.ConvertPrimitive(value!, typeof(bool)); 382var result = AtsMarshaller.ConvertPrimitive(value!, typeof(TimeSpan)); 392var result = AtsMarshaller.ConvertPrimitive(value!, typeof(int?)); 537var result = AtsMarshaller.ConvertPrimitive(value!, typeof(DateOnly)); 560var result = AtsMarshaller.ConvertPrimitive(value!, typeof(TimeOnly)); 657var result = AtsMarshaller.ConvertPrimitive(value!, typeof(long)); 667var result = AtsMarshaller.ConvertPrimitive(value!, typeof(long)); 677Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value!, typeof(long))); 685var result = AtsMarshaller.ConvertPrimitive(value!, typeof(double)); 695var result = AtsMarshaller.ConvertPrimitive(value!, typeof(double)); 705var result = AtsMarshaller.ConvertPrimitive(value!, typeof(float)); 715var result = AtsMarshaller.ConvertPrimitive(value!, typeof(decimal)); 725Assert.Throws<InvalidCastException>(() => AtsMarshaller.ConvertPrimitive(value!, typeof(decimal))); 733var result = AtsMarshaller.ConvertPrimitive(value!, typeof(TimeSpan));