Accusoft.PrizmDocServer.Exceptions.Tests.ErrorData_From_statusCode_reasonPhrase_and_body_Tests.When_JSON_contains_errorCode_and_three_results_two_of_which_contain_inner_error_info C# (CSharp) Метод

When_JSON_contains_errorCode_and_three_results_two_of_which_contain_inner_error_info() приватный Метод

        public void When_JSON_contains_errorCode_and_three_results_two_of_which_contain_inner_error_info()
        {
            ErrorData err = ErrorData.From(HttpStatusCode.OK, "wat", @"{""errorCode"":""CouldNotDoTheThing"",""output"":{""results"":[{""errorCode"":""ReallyBadProblemHappened"",""errorDetails"":{""causedBy"":""really-bad-server"",""misbehaving"":true}},{""successfulResult"":true},{""errorCode"":""YetAnotherInnerError""}]}}");

            Assert.AreEqual("CouldNotDoTheThing", err.ErrorCode);
            Assert.IsNull(err.RawErrorDetails);
            Assert.AreEqual(2, err.InnerErrors.Count);
            Assert.AreEqual("ReallyBadProblemHappened", err.InnerErrors[0].ErrorCode);
            Assert.AreEqual(JObject.Parse(@"{""causedBy"":""really-bad-server"",""misbehaving"":true}").ToString(), err.InnerErrors[0].RawErrorDetails);
            Assert.AreEqual("YetAnotherInnerError", err.InnerErrors[1].ErrorCode);
            Assert.IsNull(err.InnerErrors[1].RawErrorDetails);
        }