public void TryConvert_NullConverter_ThrowsArgumentNullException() { var policy = new ReflectionTypeConversionPolicy(); IPropertyToken token; Assert.Throws <ArgumentNullException>(() => policy.TryConvert(null, null, out token)); }
public void TryConvert_ScalarValue_ReturnsFalse() { var converter = Mock.Of <IPropertyConverter>(); var policy = new ReflectionTypeConversionPolicy(); IPropertyToken token; Assert.False(policy.TryConvert(converter, true, out token)); }
public void TryConvert_Object_ReturnsFalse() { var converter = Mock.Of <IPropertyConverter>(); var policy = new ReflectionTypeConversionPolicy(); IPropertyToken token; Assert.False(policy.TryConvert(converter, new object(), out token)); }
public void TryConvert_ReflectionType_ReturnsScalarToken() { var converter = Mock.Of <IPropertyConverter>(); var policy = new ReflectionTypeConversionPolicy(); IPropertyToken token; Assert.True(policy.TryConvert(converter, typeof(string), out token)); var scalar = token as ScalarToken; Assert.NotNull(scalar); Assert.Equal(typeof(string).ToString(), scalar.Value); }