本文整理匯總了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"));
}
示例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());
}
示例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());
}
示例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);
}
示例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();
}
示例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);
}
示例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());
}
示例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"));
}
示例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);
}
示例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);
}
示例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);
}
示例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));
}
示例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());
}
示例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)
}
示例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());
}