本文整理汇总了C#中ErrorList.Count方法的典型用法代码示例。如果您正苦于以下问题:C# ErrorList.Count方法的具体用法?C# ErrorList.Count怎么用?C# ErrorList.Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ErrorList
的用法示例。
在下文中一共展示了ErrorList.Count方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: 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);
}
示例4: 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());
}
示例5: 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);
}
示例6: 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);
}
示例7: 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());
}
示例8: 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());
}