public void Should_map_simple_types(Type type, object expected, object value) { var parameter = SimpleTypeParameters.FirstOrDefault(x => x.ParameterType.Type == type); var result = new SimpleTypeMapper().Map(new ValueMapperContext( null, null, parameter, value.AsArray())); result?.GetType().ShouldEqual(type.GetUnderlyingNullableType()); result.ShouldEqual(expected); }
public void Should_map_simple_types_to_a_list_interface(Type type, object expected, object value) { var parameter = SimpleTypeParameterListInterface.FirstOrDefault( x => x.ParameterType.ElementType.Type == type); var result = new SimpleTypeMapper().Map(new ValueMapperContext( null, null, parameter, new[] { value, value })); result?.GetType().ShouldEqual(typeof(List <>).MakeGenericType(type)); result.As <IEnumerable>().Cast <object>().ShouldOnlyContain(expected, expected); }