public void If_field_has_JsonProperty_with_name_should_use_it() { var obj = new ClassWithNameAttribute { Value = 123 }; var result = FormUrlEncodedSerializer.ToKVPairs(obj); result.First().Key.Should().Be("some_name"); }
public void SerializeDecimal(decimal value, string expected) { var obj = new ClassWithDecimalValue { Value = value }; var result = FormUrlEncodedSerializer.ToKVPairs(obj); result.First().Value.Should().Be(expected); }
public void SerializeString(string value) { var obj = new ClassWithStringValue { Value = value }; var result = FormUrlEncodedSerializer.ToKVPairs(obj); result.First().Value.Should().Be(value); }
public void If_field_has_no_JsonProperty_then_should_the_actual_property_name() { var obj = new ClassWithAttributeButNoName { Value = 123 }; var result = FormUrlEncodedSerializer.ToKVPairs(obj); result.First().Key.Should().Be("Value"); }
private void Should_include_properties_from_base_class() { var obj = new InheritingClass { PropertyInBase = 234 }; var result = FormUrlEncodedSerializer.ToKVPairs(obj); result.First().Key.Should().Be("PropertyInBase"); result.First().Value.Should().Be("234"); }
public void Serialize_two_properties() { var obj = new ClassWithTwoProperties { Value1 = "abc", Value2 = "def" }; var result = FormUrlEncodedSerializer.ToKVPairs(obj); var property1 = result.First(kv => kv.Key == "val1"); property1.Value.Should().Be("abc"); var property2 = result.First(kv => kv.Key == "val2"); property2.Value.Should().Be("def"); }