コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
ファイル: JsonTests.cs プロジェクト: khoussem/Exceptionless
 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;
 }