Skip to content

Commit

Permalink
Merge pull request #142 from ivanpovazan/sub_groups_ns_fix
Browse files Browse the repository at this point in the history
[test] improving BPMN testing with examples from http://www.bpmn.org/
  • Loading branch information
mganss authored Oct 2, 2019
2 parents 0e5e71b + c8cc07c commit 5074d7a
Show file tree
Hide file tree
Showing 36 changed files with 21,481 additions and 12 deletions.
101 changes: 100 additions & 1 deletion XmlSchemaClassGenerator.Tests/XmlSchemaClassGenerator.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,106 @@
<None Update="xml\assistedLiving_min.xml">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmnSimple.xml">
<None Update="xml\bpmn_tests\Airline Check In.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Amazon Fulfillment.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Bank Account Opening.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Book Writing and Publishing.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\BPI Web Registration with Moderator.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\BPI Web Registration without Moderator.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\bpmnSimple.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Commercial Financing.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Customer Quote Request.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\EMail Voting %28BPMN 2.0%29.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Email-Voting-%28BPMN 1.2%29.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Employee Expence Reimbursement Request - Alternative 1.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Employee Expence Reimbursement Request - Alternative 2.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Incident Management as Choreography.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Incident Management as Detailed Collaboration.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Insurance Claim Processing.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Journal Review Process.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\LaserTec Production Process.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Mortgage Approval.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\New Car Sales.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Order fulfillment - BPMN v2.0 Specifications.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Order Fulfillment and Procurement.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Order Fulfillment.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Order Processing.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Patient Treatment - Abstract Process.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Patient Treatment - Collaboration and Choreography.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Patient Treatment - Collaboration.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Pizza Co. Delivery Process.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Property and Casualty Insurance Claim Processing.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Shipment Process of a Hardware Retailer.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\The Nobel Prize.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\The Pizza Collaboration.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Travel Booking with Event Sub-processes.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\bpmn_tests\Travel Booking.bpmn">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xml\compulsoryAuction_max.xml">
Expand Down
29 changes: 18 additions & 11 deletions XmlSchemaClassGenerator.Tests/XmlTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,21 +399,28 @@ void UnknownAttributeHandler(object sender, XmlAttributeEventArgs e)
unknownAttrError = true;
}

var xml = ReadXml("bpmnSimple");
var reader = XmlReader.Create(new StringReader(xml));
var currDir = Directory.GetCurrentDirectory();
var testDir = "bpmn_tests";
var fileExt = "bpmn";
var testFiles = Glob.ExpandNames(string.Format("{0}\\xml\\{1}\\*.{2}", currDir, testDir, fileExt));

var isDeserializable = serializer.CanDeserialize(reader);
Assert.True(isDeserializable);
foreach (var testFile in testFiles)
{
var xmlString = File.ReadAllText(testFile);
var reader = XmlReader.Create(new StringReader(xmlString), new XmlReaderSettings { IgnoreWhitespace = true });

var isDeserializable = serializer.CanDeserialize(reader);
Assert.True(isDeserializable);

var deserializedObject = serializer.Deserialize(reader);
Assert.False(unknownNodeError);
Assert.False(unknownAttrError);
var deserializedObject = serializer.Deserialize(reader);
Assert.False(unknownNodeError);
Assert.False(unknownAttrError);

var serializedXml = Serialize(serializer, deserializedObject, GetNamespacesFromSource(xml));
File.WriteAllText("file.xml", serializedXml);
var serializedXml = Serialize(serializer, deserializedObject, GetNamespacesFromSource(xmlString));

var deserializedXml = serializer.Deserialize(new StringReader(serializedXml));
AssertEx.Equal(deserializedObject, deserializedXml);
var deserializedXml = serializer.Deserialize(new StringReader(serializedXml));
AssertEx.Equal(deserializedObject, deserializedXml);
}
}

private IDictionary<string, string> GetNamespacesFromSource(string source)
Expand Down
Loading

0 comments on commit 5074d7a

Please sign in to comment.