当前位置: 首页>>代码示例>>C#>>正文


C# ErrorList.ToString方法代码示例

本文整理汇总了C#中ErrorList.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorList.ToString方法的具体用法?C# ErrorList.ToString怎么用?C# ErrorList.ToString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ErrorList的用法示例。


在下文中一共展示了ErrorList.ToString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: BinaryParsing

        public void BinaryParsing()
        {
            string xmlString = @"<Binary id='pic1' contentType='image/gif' xmlns='http://hl7.org/fhir'>R0lGODlhEwARAPcAAAAAAAAA/+9aAO+1AP/WAP/eAP/eCP/eEP/eGP/nAP/nCP/nEP/nIf/nKf/nUv/nWv/vAP/vCP/vEP/vGP/vIf/vKf/vMf/vOf/vWv/vY//va//vjP/3c//3lP/3nP//tf//vf///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH5BAEAAAEALAAAAAATABEAAAi+AAMIDDCgYMGBCBMSvMCQ4QCFCQcwDBGCA4cLDyEGECDxAoAQHjxwyKhQAMeGIUOSJJjRpIAGDS5wCDly4AALFlYOgHlBwwOSNydM0AmzwYGjBi8IHWoTgQYORg8QIGDAwAKhESI8HIDgwQaRDI1WXXAhK9MBBzZ8/XDxQoUFZC9IiCBh6wEHGz6IbNuwQoSpWxEgyLCXL8O/gAnylNlW6AUEBRIL7Og3KwQIiCXb9HsZQoIEUzUjNEiaNMKAAAA7</Binary>";

            ErrorList errors = new ErrorList();
            Binary result = (Binary)FhirParser.ParseResourceFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());

            Assert.AreEqual("image/gif", result.ContentType);
            Assert.AreEqual(993, result.Content.Length);
            Assert.IsTrue(Encoding.ASCII.GetString(result.Content).StartsWith("GIF89a"));

            byte[] data = result.Content;
            File.WriteAllBytes(@"c:\temp\test.gif", data);

            string json = "{ Binary: { contentType : \"image/gif\", " +
                        "content: \"R0lGODlhEwARAPcAAAAAAAAA/+9aAO+1AP/WAP/eAP/eCP/eEP/eGP/nAP/nCP/nEP/nIf/nKf/nUv/nWv/vAP/vCP/vEP/vGP/vIf/vKf/vMf/vOf/vWv/vY//va//vjP/3c//3lP/3nP//tf//vf///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////yH5BAEAAAEALAAAAAATABEAAAi+AAMIDDCgYMGBCBMSvMCQ4QCFCQcwDBGCA4cLDyEGECDxAoAQHjxwyKhQAMeGIUOSJJjRpIAGDS5wCDly4AALFlYOgHlBwwOSNydM0AmzwYGjBi8IHWoTgQYORg8QIGDAwAKhESI8HIDgwQaRDI1WXXAhK9MBBzZ8/XDxQoUFZC9IiCBh6wEHGz6IbNuwQoSpWxEgyLCXL8O/gAnylNlW6AUEBRIL7Og3KwQIiCXb9HsZQoIEUzUjNEiaNMKAAAA7\" } }";
            errors.Clear();
            result = (Binary)FhirParser.ParseResourceFromJson(json, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());

            Assert.AreEqual("image/gif", result.ContentType);
            Assert.AreEqual(993, result.Content.Length);
            Assert.IsTrue(Encoding.ASCII.GetString(result.Content).StartsWith("GIF89a"));
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:25,代码来源:CompositeParserTests.cs

示例2: ParseEmptyPrimitive

        public void ParseEmptyPrimitive()
        {
            string xmlString = "<someString xmlns='http://hl7.org/fhir' id='4' />";
            ErrorList errors = new ErrorList();
            FhirString result = (FhirString)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.IsNotNull(result);
            Assert.IsNull(result.Value);
            Assert.AreEqual("4", result.LocalId.ToString());

            xmlString = "<someString xmlns='http://hl7.org/fhir' id='4' value='' />";
            errors.Clear();
            result = (FhirString)FhirParser.ParseElementFromXml(xmlString, errors);

            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.IsNotNull(result);
            Assert.IsNull(result.Value);
            Assert.AreEqual("4", result.LocalId.ToString());

            string jsonString = "{ \"someString\" : { \"_id\" : \"4\" } }";
            errors.Clear();
            result = (FhirString)FhirParser.ParseElementFromJson(jsonString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.IsNotNull(result);
            Assert.IsNull(result.Value);
            Assert.AreEqual("4", result.LocalId.ToString());

            jsonString = "{ \"someString\" : { \"_id\" : \"4\", \"value\" : \"\" } }";
            errors.Clear();
            result = (FhirString)FhirParser.ParseElementFromJson(jsonString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.IsNotNull(result);
            Assert.IsNull(result.Value);
            Assert.AreEqual("4", result.LocalId.ToString());
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:35,代码来源:PrimitiveParserTests.cs

示例3: ParsePrimitive

        public void ParsePrimitive()
        {
            string xmlString = "<someBoolean xmlns='http://hl7.org/fhir' value='true' id='3141' />";
            ErrorList errors = new ErrorList();
            FhirBoolean result = (FhirBoolean)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count == 0, errors.ToString());
            Assert.AreEqual(true, result.Value);
            Assert.AreEqual("3141", result.Id.ToString());

            string jsonString = "{\"someBoolean\": { \"value\" : true, \"_id\" : \"3141\" } }";
            errors.Clear();
            result = (FhirBoolean)FhirParser.ParseElementFromJson(jsonString, errors);
            Assert.IsTrue(errors.Count == 0, errors.ToString());
            Assert.AreEqual(true, result.Value);
            Assert.AreEqual("3141", result.Id.ToString());
        }
开发者ID:jamesagnew,项目名称:fhir-net-api,代码行数:16,代码来源:PrimitiveParserTests.cs

示例4: NarrativeParsing

        public void NarrativeParsing()
        {
            string xmlString = @"<testNarrative xmlns='http://hl7.org/fhir'>
                                    <status value='generated' />
                                    <div xmlns='http://www.w3.org/1999/xhtml'>Whatever</div>
                                 </testNarrative>";

            ErrorList errors = new ErrorList();
            Narrative result = (Narrative)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(Narrative.NarrativeStatus.Generated, result.Status.Value);
            Assert.IsTrue(result.Div != null);

            xmlString = @"<testNarrative xmlns='http://hl7.org/fhir'>
                             <status value='generated' />
                             <xhtml:div xmlns:xhtml='http://www.w3.org/1999/xhtml'>Whatever</xhtml:div>
                          </testNarrative>";
            errors.Clear();

            result = (Narrative)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(Narrative.NarrativeStatus.Generated, result.Status.Value);
            Assert.IsTrue(result.Div != null);

            xmlString = @"<testNarrative xmlns='http://hl7.org/fhir' xmlns:xhtml='http://www.w3.org/1999/xhtml'>
                              <status value='generated' />
                              <xhtml:div>Whatever</xhtml:div>
                          </testNarrative>";
            errors.Clear();

            result = (Narrative)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(Narrative.NarrativeStatus.Generated, result.Status.Value);
            Assert.IsTrue(result.Div != null);

            string jsonString = "{ \"testNarrative\" : {" +
                "\"status\" : { \"value\" : \"generated\" }, " +
                "\"div\" : " +
                "\"<div xmlns='http://www.w3.org/1999/xhtml'>Whatever</div>\" } }";

            errors.Clear();
            result = (Narrative)FhirParser.ParseElementFromJson(jsonString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(Narrative.NarrativeStatus.Generated, result.Status.Value);
            Assert.IsTrue(result.Div != null);
        }
开发者ID:jamesagnew,项目名称:fhir-net-api,代码行数:46,代码来源:CompositeParserTests.cs

示例5: CatchTagListParseErrors

        public void CatchTagListParseErrors()
        {
            ErrorList errors = new ErrorList();
            var tl = FhirParser.ParseTagListFromXml(xmlTagListE1, errors);
            Assert.IsTrue(errors.Count != 0, errors.ToString());
            errors.Clear();
            tl = FhirParser.ParseTagListFromXml(xmlTagListE2, errors);
            Assert.IsTrue(errors.Count != 0, errors.ToString());
            errors.Clear();

            tl = FhirParser.ParseTagListFromJson(jsonTagListE1, errors);
            Assert.IsTrue(errors.Count != 0, errors.ToString());
            errors.Clear();
            tl = FhirParser.ParseTagListFromJson(jsonTagListE2, errors);
            Assert.IsTrue(errors.Count != 0, errors.ToString());
            errors.Clear();
        }
开发者ID:vista-novo,项目名称:fhir,代码行数:17,代码来源:TagTests.cs

示例6: SerializeAndDeserializeTagList

        public void SerializeAndDeserializeTagList()
        {
            IList<Tag> tl = new List<Tag>();

            tl.Add(new Tag("http://www.nu.nl/tags", Tag.FHIRTAGSCHEME, "No!"));
            tl.Add(new Tag("http://www.furore.com/tags", Tag.FHIRTAGSCHEME, "Maybe, indeed" ));

            string json = FhirSerializer.SerializeTagListToJson(tl);
            Assert.AreEqual(jsonTagList, json);

            string xml = FhirSerializer.SerializeTagListToXml(tl);
            Assert.AreEqual(xmlTagList, xml);

            ErrorList errors = new ErrorList();
            tl = FhirParser.ParseTagListFromXml(xml, errors);
            Assert.IsTrue(errors.Count == 0, errors.ToString());
            verifyTagList(tl);

            tl = FhirParser.ParseTagListFromJson(json, errors);
            Assert.IsTrue(errors.Count == 0, errors.ToString());
            verifyTagList(tl);
        }
开发者ID:vista-novo,项目名称:fhir,代码行数:22,代码来源:TagTests.cs

示例7: CompositeWithRepeatingElement

        public void CompositeWithRepeatingElement()
        {
            string xmlString = @"
                <testCodeableConcept xmlns='http://hl7.org/fhir'>
                    <coding>
                        <system value=""http://hl7.org/fhir/sid/icd-10"" />
                        <code value=""R51"" />
                    </coding>
                    <coding id='1'>
                        <system value=""http://snomed.info/id"" />
                        <code value=""25064002"" />
                    </coding>
                </testCodeableConcept>";

            ErrorList errors = new ErrorList();
            CodeableConcept result = (CodeableConcept)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(2, result.Coding.Count);
            Assert.AreEqual("R51", result.Coding[0].Code);
            Assert.AreEqual("25064002", result.Coding[1].Code);
            Assert.AreEqual("http://snomed.info/id", result.Coding[1].System.ToString());
            Assert.AreEqual("1", result.Coding[1].LocalId.ToString());

            string jsonString = @"{ ""testCodeableConcept"" :
                    { ""coding"" : [
                        { ""system"" : { ""value"" : ""http://hl7.org/fhir/sid/icd-10"" },
                          ""code"" : { ""value"" : ""R51"" } },
                        { ""_id"" : ""1"",
                          ""system"": { ""value"" : ""http://snomed.info/id"" },
                          ""code"" : { ""value"" : ""25064002"" } } ]
                    } }";

            errors.Clear();
            result = (CodeableConcept)FhirParser.ParseElementFromJson(jsonString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual(2, result.Coding.Count);
            Assert.AreEqual("R51", result.Coding[0].Code);
            Assert.AreEqual("25064002", result.Coding[1].Code);
            Assert.AreEqual("http://snomed.info/id", result.Coding[1].System.ToString());
            Assert.AreEqual("1", result.Coding[1].LocalId.ToString());
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:41,代码来源:CompositeParserTests.cs

示例8: ParseExtendedPrimitiveWithOtherElements

        public void ParseExtendedPrimitiveWithOtherElements()
        {
            string xmlString =
                @"<birthDate xmlns='http://hl7.org/fhir' value='1972-11-30'>
                    <crap />
                    <extension>
                       <url value='http://hl7.org/fhir/profile/@iso-21090#nullFlavor' />
                       <valueCode value='UNK' />
                    </extension>
                  </birthDate>";

            ErrorList errors = new ErrorList();
            Date result = (Date)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.AreNotEqual(0, errors.Count);
            Assert.IsTrue(errors.ToString().Contains("crap"));

            xmlString =
                @"<birthDate xmlns='http://hl7.org/fhir' value='1972-11-30'>
                    <crap xmlns=""http://furore.com"" />
                    <extension>
                       <url value='http://hl7.org/fhir/profile/@iso-21090#nullFlavor' />
                       <valueCode value='UNK' />
                    </extension>
                  </birthDate>";

            errors.Clear();
            result = (Date)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.AreNotEqual(0, errors.Count);
            Assert.IsTrue(errors.ToString().Contains("crap"));


            string jsonString = @"{ ""birthDate"" : 
                                { 
                                    ""value"" : ""1972-11-30"",
                                    ""crap"" : {},
                                    ""extension"" : [
                                    {
                                        ""url"" : { ""value"" : ""http://hl7.org/fhir/profile/@iso-21090#nullFlavor"" },
                                        ""valueCode"" : { ""value"" : ""UNK"" }
                                    } ]
                                }
                            }";

            errors.Clear();
            result = (Date)FhirParser.ParseElementFromJson(jsonString, errors);
            Assert.AreNotEqual(0, errors.Count);
            Assert.IsTrue(errors.ToString().Contains("crap"));
        }
开发者ID:jamesagnew,项目名称:fhir-net-api,代码行数:48,代码来源:PrimitiveParserTests.cs

示例9: TestParseBinary

        public void TestParseBinary()
        {
            var errors = new ErrorList();
            Binary result = (Binary)FhirParser.ParseResourceFromXml(binaryXml, errors);
            Assert.AreEqual(0, errors.Count, errors.ToString());
            Assert.IsNotNull(result);

            Assert.AreEqual("image/gif", result.ContentType);
            Assert.AreEqual(Narrative.NarrativeStatus.Generated, result.Text.Status);
            Assert.AreEqual(59, result.Content[0]);
            Assert.AreEqual(993, result.Content.Length);
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:12,代码来源:CompositeParserTests.cs

示例10: validateDiagReportAttributes

        private static void validateDiagReportAttributes(ErrorList errors, DiagnosticReport rep)
        {
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.IsNotNull(rep);

            Assert.AreEqual("2011-03-04T08:30:00+11:00", rep.DiagnosticTime.ToString());
            Assert.AreEqual(17, rep.Contained.Count);
            Assert.AreEqual(17, rep.Results.Result.Count);

            Assert.IsNotNull(rep.Contained[1] as Observation);
            Observation obs1 = (Observation)rep.Contained[1];
            Assert.AreEqual(typeof(Quantity), obs1.Value.GetType());
            Assert.AreEqual((decimal)5.9, (obs1.Value as Quantity).Value.Value);

            Assert.IsNotNull(rep.Contained[8] as Observation);
            Observation obs8 = (Observation)rep.Contained[8];
            Assert.AreEqual("Neutrophils", obs8.Name.Coding[0].Display);
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:18,代码来源:CompositeParserTests.cs

示例11: ParseSimpleComposite

        public void ParseSimpleComposite()
        {
            string xmlString = @"<testCoding id='x4' xmlns='http://hl7.org/fhir'>
                                    <system value='http://hl7.org/fhir/sid/icd-10' />
                                    <code value='G44.1' />
                                 </testCoding>";

            ErrorList errors = new ErrorList();
            Coding result = (Coding)FhirParser.ParseElementFromXml(xmlString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual("x4", result.LocalId.ToString());
            Assert.AreEqual("G44.1", result.Code);
            Assert.AreEqual("http://hl7.org/fhir/sid/icd-10", result.System.ToString());
            Assert.IsNull(result.Display);

            string jsonString = "{ \"testCoding\" : { \"_id\" : \"x4\", " +
                    "\"system\": { \"value\" : \"http://hl7.org/fhir/sid/icd-10\" }, " +
                    "\"code\": { \"value\" : \"G44.1\" } } }";

            errors.Clear();
            result = (Coding)FhirParser.ParseElementFromJson(jsonString, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.AreEqual("x4", result.LocalId);
            Assert.AreEqual("G44.1", result.Code);
            Assert.AreEqual("http://hl7.org/fhir/sid/icd-10", result.System.ToString());
            Assert.IsNull(result.Display);
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:27,代码来源:CompositeParserTests.cs

示例12: ParseBundleDeletedEntryJson

        public void ParseBundleDeletedEntryJson()
        {
            ErrorList errors = new ErrorList();

            var input = testDeletedEntryAsJson;
            var result = FhirParser.ParseBundleEntry(Util.JsonReaderFromString(input), errors);
            Assert.IsTrue(result is DeletedEntry);

            Assert.IsNotNull(result);
            Assert.AreEqual(0, errors.Count, errors.Count > 0 ? errors.ToString() : null);

            Assert.AreEqual(input, FhirSerializer.SerializeBundleEntryToJson(result));
        }
开发者ID:vista-novo,项目名称:fhir,代码行数:13,代码来源:BundleTests.cs

示例13: ParseNameWithExtensions

        public void ParseNameWithExtensions()
        {
            string xmlString =
                @"<Patient xmlns='http://hl7.org/fhir'>
                    <name>
                        <use value='official' />
                        <given value='Regina' />
                        <prefix value='Dr.'>
                        <extension>
                            <url value='http://hl7.org/fhir/profile/@iso-20190' />
                            <valueCoding>
                                <system value='urn:oid:2.16.840.1.113883.5.1122' />
                                <code value='AC' />
                            </valueCoding>
                        </extension>
                        </prefix>
                    </name>
                    <text>
                        <status value='generated' />
                        <div xmlns='http://www.w3.org/1999/xhtml'>Whatever</div>
                    </text>
                </Patient>";

            ErrorList errors = new ErrorList();
            Patient p = (Patient)FhirParser.ParseResourceFromXml(xmlString, errors);

            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.IsNotNull(p);
            Assert.AreEqual(1, p.Name[0].PrefixElement[0].Extension.Count());
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:30,代码来源:CompositeParserTests.cs

示例14: ParsePerformance

        public void ParsePerformance()
        {
            //string file = @"..\..\..\loinc.json";
            string file = @"..\..\..\..\..\publish\diagnosticreport-example.xml";

            int repeats = 20;

            System.Diagnostics.Stopwatch sw = new System.Diagnostics.Stopwatch();

            sw.Start();

            ErrorList errors = new ErrorList();

            for (int i = 0; i < repeats; i++)
            {
                errors.Clear();
                var xmlr = XmlReader.Create(file);
                //var jsonr = new JsonTextReader(new System.IO.StreamReader(file));
                //var rep = FhirParser.ParseResource(jsonr, errors);
                var rep = FhirParser.ParseResource(xmlr, errors);
            }

            Assert.IsTrue(errors.Count == 0, errors.ToString());

            sw.Stop();

            FileInfo f = new FileInfo(file);
            long bytesPerMs = f.Length * repeats / sw.ElapsedMilliseconds;

            File.WriteAllText(@"c:\temp\speedtest.txt", bytesPerMs.ToString() + " bytes per ms");
              //  Assert.IsTrue(bytesPerMs > 10*1024);       // > 10k per ms (Speed is of course very dependent on debug/release and machine)
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:32,代码来源:CompositeParserTests.cs

示例15: ParseJsonNativeTypes

        public void ParseJsonNativeTypes()
        {
            string json = "{ testExtension: { url: { value : \"http://bla.com\" }," +
                        "isModifier: { value: true }, valueInteger: { value: 14 } } }";

            var errors = new ErrorList();
            var result = (Extension)FhirParser.ParseElementFromJson(json, errors);
            Assert.IsTrue(errors.Count() == 0, errors.ToString());
            Assert.IsTrue(result.IsModifier.Value);
            Assert.AreEqual(14, ((Integer)result.Value).Value.Value);

            string jsonWrong = "{ testExtension: { url: { value : \"http://bla.com\" }," +
                        "isModifier: { value: \"true\" }, valueInteger: { value: \"14\" } } }";
            errors.Clear();
            result = (Extension)FhirParser.ParseElementFromJson(jsonWrong, errors);
            Assert.IsTrue(errors.Count() > 0);
            Assert.IsTrue(errors.ToString().Contains("Expected") &&
                        errors.ToString().Contains("Boolean"),errors.ToString());
        }
开发者ID:avontd2868,项目名称:vista-novo-fhir,代码行数:19,代码来源:CompositeParserTests.cs


注:本文中的ErrorList.ToString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。