private HasPropertyWithException CreateObjectWithException(string name = "Blake", int birthYear = 1986) { var person = new HasPropertyWithException(name) { UnknownData = new { BirthYear = birthYear } }; person.ExtendedData["BirthYear"] = birthYear; person.SecureValue = "1112222333"; return(person); }
public string SerializeObjectWithErrors() { HasPropertyWithException person = CreateObjectWithException(); person.ExtendedData["children"] = CreatePerson("buddy", 2008); Assert.Throws(typeof(JsonSerializationException), () => ModelSerializer.Current.SerializeToString(person)); string value = ModelSerializer.Current.SerializeToString(person, ignoreSerializationErrors: true); Assert.NotNull(value); Approvals.Verify(value); return(value); }
private HasPropertyWithException CreateObjectWithException(string name = "Blake", int birthYear = 1986) { var person = new HasPropertyWithException(name) { UnknownData = new { BirthYear = birthYear } }; person.ExtendedData["BirthYear"] = birthYear; person.SecureValue = "1112222333"; return person; }