public async ValueTask <ConversionResult> ConvertAsync(ConverterContext context) { await Task.Delay(1); // simulate an async operation. var customer = new Customer(context.Source.ToString(), context.Source + "-converted customer"); return(ConversionResult.Success(value: customer)); }
public void Verify_Success_Result_Properties() { var conversionResult = ConversionResult.Success(value: "foo"); Assert.Equal(ConversionStatus.Succeeded, conversionResult.Status); Assert.Null(conversionResult.Error); var convertedValue = TestUtility.AssertIsTypeAndConvert <string>(conversionResult.Value); Assert.Equal("foo", convertedValue); }
public ValueTask <ConversionResult> ConvertAsync(ConverterContext context) { var result = ConversionResult.Success(value: context.Source + "-converted value"); return(new ValueTask <ConversionResult>(result)); }