mirror of
https://github.com/AlexMacocian/MTSC.git
synced 2026-07-17 15:59:32 +00:00
31 lines
900 B
C#
31 lines
900 B
C#
using System;
|
|
using System.ComponentModel;
|
|
using System.Globalization;
|
|
using MTSC.Common.Http;
|
|
|
|
namespace MTSC.UnitTests.RoutingModules
|
|
{
|
|
public class SomeResponseConverter : TypeConverter
|
|
{
|
|
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
|
|
{
|
|
if (destinationType == typeof(SomeRoutingResponse))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
return base.CanConvertTo(context, destinationType);
|
|
}
|
|
|
|
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
|
|
{
|
|
if (value is SomeRoutingResponse)
|
|
{
|
|
return new HttpResponse { StatusCode = HttpMessage.StatusCodes.OK };
|
|
}
|
|
|
|
return base.ConvertTo(context, culture, value, destinationType);
|
|
}
|
|
}
|
|
}
|