public void Should_serialize_value(Type type, object value) { Skip.If(this.TestIs <JsonSerializer>() && type.Is <DateTimeOffset>(), "DateTimeOffset not supported by JsonSerializer"); Skip.If(this.TestIs <JsonSerializer>() && type.Is <Complex>(), "Complex not supported by JsonSerializer"); Skip.If(this.TestIs <JsonSerializer>() && type.Is <decimal>(), "Decimal not supported by JsonSerializer"); SkipOnNetCoreApp1_0.If(this.TestIs <JsonSerializer>() && type.Is <BigInteger>(), "BigInteger not supported by JsonSerializer on CORE CLR"); SkipOnNetCoreApp1_0.If(this.TestIs <JsonSerializer>() && type.Is <ulong>(), "UInt64 not supported by JsonSerializer on CORE CLR"); SkipOnNetCoreApp1_0.If(this.TestIs <DataContractSerializer>() && type.Is <BigInteger>(), "BigInteger not supported by DataContractSerializer on CORE CLR"); SkipOnNetCoreApp1_0.If(this.TestIs <DataContractSerializer>() && type.Is <Complex>(), "Complex not supported by DataContractSerializer on CORE CLR"); var result = SerializeMethod.MakeGenericMethod(type).Invoke(this, new[] { value, true }); result.ShouldBe(value, $"type: {type.FullName}"); }
public void Should_map_native_value_property(Type type, object value) { SkipOnNetCoreApp1_0.If(type.Is <Complex>(), "Complex fails on CORE CLR 1.0.1 on Ubuntu (travis-ci)"); var result = MapAsPropertyMethod.MakeGenericMethod(type).Invoke(null, new[] { value }); if (result == null) { if (type.IsValueType()) { var message = $"value must not be null for type {type}"; type.IsGenericType().ShouldBeTrue(message); type.GetGenericTypeDefinition().ShouldBe(typeof(Nullable <>), message); } } else { result.ShouldBeAssignableTo(type); } result.ShouldBe(value); }