Skip to content

Commit

Permalink
Add tableau test
Browse files Browse the repository at this point in the history
Exclude IATA test (takes too long)
Only test schema valid xml samples
Better (still hacky) support for choices (fixes #76)
Always use DateTime for xs:time
  • Loading branch information
Michael Ganss committed Jul 27, 2018
1 parent 410bbdf commit 20919f5
Show file tree
Hide file tree
Showing 11 changed files with 1,072 additions and 124 deletions.
12 changes: 5 additions & 7 deletions XmlSampleGenerator/Generator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ public object GetEnumerationValue() {
}
public void ProcessLengthFacet(ref StringBuilder genString, int index) {
int pLength = genString.Length;
int indexLen = index.ToString().Length;
int correctLen = length - indexLen;
int correctLen = length;
if(pLength > correctLen) {
genString.Remove(correctLen,pLength-correctLen);
}
Expand All @@ -324,8 +323,7 @@ public void ProcessMinLengthFacet(ref StringBuilder genString, int index) {

public void ProcessMaxLengthFacet(ref StringBuilder genString, int index) {
int pLength = genString.Length;
int indexLen = index.ToString().Length;
int correctLen = maxLength - indexLen;
int correctLen = maxLength;
if(pLength > correctLen) {
genString.Remove(correctLen,pLength-correctLen);
}
Expand Down Expand Up @@ -371,17 +369,17 @@ public override string GenerateValue() {
}
else {
if(length != -1) { // The length facet is set
ProcessLengthFacet(ref genString, endValue);
genString.Append(endValue);
ProcessLengthFacet(ref genString, endValue);
}
else {
if(minLength != -1) {
genString.Append(endValue);
if (minLength != -1) {
ProcessMinLengthFacet(ref genString, endValue);
}
if(maxLength != -1) {
ProcessMaxLengthFacet(ref genString, endValue);
}
genString.Append(endValue);
}
}
string result = genString.ToString();
Expand Down
3 changes: 0 additions & 3 deletions XmlSchemaClassGenerator.Console/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ static void Main(string[] args)
var generateDebuggerStepThroughAttribute = true;
var disableComments = false;
var doNotUseUnderscoreInPrivateMemberNames = false;
var timeType = false;

var options = new OptionSet {
{ "h|help", "show this message and exit", v => showHelp = v != null },
Expand Down Expand Up @@ -80,7 +79,6 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l
{ "dst|debuggerStepThrough", "generate DebuggerStepThroughAttribute (default is enabled)", v => generateDebuggerStepThroughAttribute = v != null },
{ "dc|disableComments", "do not include comments from xsd", v => disableComments = v != null },
{ "nu|noUnderscore", "do not generate underscore in private member name (default is false)", v => doNotUseUnderscoreInPrivateMemberNames = v != null },
{ "tt|timeAsDateTime", "map xs:time to DateTime instead of string", v => timeType = v != null },
};

var files = options.Parse(args);
Expand Down Expand Up @@ -124,7 +122,6 @@ A file name may be given by appending a pipe sign (|) followed by a file name (l
TextValuePropertyName = textValuePropertyName,
GenerateDebuggerStepThroughAttribute = generateDebuggerStepThroughAttribute,
DisableComments = disableComments,
TimeDataType = timeType ? typeof(DateTime) : typeof(string)
};

if (pclCompatible)
Expand Down
1 change: 0 additions & 1 deletion XmlSchemaClassGenerator.Tests/Compiler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ public static Assembly GenerateFiles(string name, IEnumerable<string> files, Gen
EntityFramework = generatorPrototype.EntityFramework,
GenerateInterfaces = generatorPrototype.GenerateInterfaces,
MemberVisitor = generatorPrototype.MemberVisitor,
TimeDataType = generatorPrototype.TimeDataType
};

gen.Generate(files);
Expand Down
159 changes: 159 additions & 0 deletions XmlSchemaClassGenerator.Tests/XmlSchemaClassGenerator.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,162 @@
<None Update="xsd\elster-xml-datenabholung5\th000008_extern.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\Acknowledgement.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\aidm_commontypes.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirDocDisplayRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirDocDisplayRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirDocHistoryRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirDocHistoryRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirDocIssueRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirDocNotifRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirlineProfileNotif.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirlineProfileRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirlineProfileRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirShoppingRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\AirShoppingRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\BaggageAllowanceRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\BaggageAllowanceRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\BaggageChargesRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\BaggageChargesRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\BaggageListRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\BaggageListRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\CustomerInputRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\CustomerInputRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\edist_commontypes.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\edist_structures.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\FareRulesRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\FareRulesRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\FileRetrieveRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\FileRetrieveRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\InvGuaranteeRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\InvGuaranteeRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\InvReleaseNotif.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OfferPriceRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OfferPriceRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderCancelRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderCancelRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderChangeNotif.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderChangeRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderCreateRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderHistoryRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderHistoryRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderListRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderListRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderReshopRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderReshopRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderRetrieveRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderRulesRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderRulesRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\OrderViewRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\SeatAvailabilityRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\SeatAvailabilityRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\ServiceListRQ.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\ServiceListRS.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\iata\xmldsig-core-schema.xsd">
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
</None>
<None Update="xsd\is24immotransfer\is24immotransfer.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down Expand Up @@ -265,6 +421,9 @@
<None Update="xsd\is24\search\shortlist-1.0.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\ts-api\ts-api_2_8.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="xsd\wadl\wadl.xsd">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
Expand Down
Loading

0 comments on commit 20919f5

Please sign in to comment.