private Convert ( object sourceValue, |
||
sourceValue | object | |
targetType | ||
Résultat | object |
public void DoConvertTest(object value, object expected, Type expectedType) { var target = new ValueConverter(); object actual = target.Convert(value, expectedType); actual.ShouldBe(expected); }
public void DoConvert_NullableNull_ConvertsToNull(Type innerType) { var target = new ValueConverter(); Type genericNullableType = typeof (Nullable<>); Type concreteType = genericNullableType.MakeGenericType(innerType); object value = Activator.CreateInstance(concreteType); object actual = target.Convert(value, concreteType); actual.ShouldBe(null); }
public void ConvertFailureTest() { var target = new ValueConverter(); Should.Throw<InvalidOperationException>(() => target.Convert(null, typeof (int))); }
public void DoConvert_NullableNotNull_ConvertsToNull() { var target = new ValueConverter(); DateTime? value = DateTime.Now; object actual = target.Convert(value, typeof (DateTime?)); actual.ShouldBe(value); actual.ShouldNotBeSameAs(value); }