diff --git a/XmlSchemaClassGenerator.Tests/XmlTests.cs b/XmlSchemaClassGenerator.Tests/XmlTests.cs index b830e08d..46e58f20 100644 --- a/XmlSchemaClassGenerator.Tests/XmlTests.cs +++ b/XmlSchemaClassGenerator.Tests/XmlTests.cs @@ -53,7 +53,7 @@ private IEnumerable ConvertXml(string name, string xsd, Generator genera { var schema = XmlSchema.Read(stringReader, (s, e) => { - throw new InvalidOperationException(); + throw new InvalidOperationException($"{e.Severity}: {e.Message}",e.Exception); }); set.Add(schema); @@ -632,7 +632,7 @@ public void ChoiceMembersAreNullable() } [Fact] - public void AssemblyVisibleIsInternal() + public void AssemblyVisibleIsInternalClass() { // We test to see whether choices which are part of a larger ComplexType are marked as nullable. // Because nullability isn't directly exposed in the generated C#, we use "XXXSpecified" on a value type @@ -675,6 +675,70 @@ public void AssemblyVisibleIsInternal() Assert.Contains("internal partial class Root", content); } + [Fact] + public void AssemblyVisibleIsInternalEnum() + { + // We test to see whether choices which are part of a larger ComplexType are marked as nullable. + // Because nullability isn't directly exposed in the generated C#, we use "XXXSpecified" on a value type + // as a proxy. + + const string xsd = @" + + + + + + + + +"; + + var generator = new Generator + { + NamespaceProvider = new NamespaceProvider + { + GenerateNamespace = key => "Test" + }, + AssemblyVisible = true + }; + var contents = ConvertXml(nameof(ComplexTypeWithAttributeGroupExtension), xsd, generator); + var content = Assert.Single(contents); + + Assert.Contains("internal enum Answer", content); + } + + [Fact] + public void AssemblyVisibleIsInternalInterface() + { + // We test to see whether choices which are part of a larger ComplexType are marked as nullable. + // Because nullability isn't directly exposed in the generated C#, we use "XXXSpecified" on a value type + // as a proxy. + + const string xsd = @" + + + + + + + +"; + + var generator = new Generator + { + NamespaceProvider = new NamespaceProvider + { + GenerateNamespace = key => "Test" + }, + GenerateInterfaces = true, + AssemblyVisible = true + }; + var contents = ConvertXml(nameof(ComplexTypeWithAttributeGroupExtension), xsd, generator); + var content = Assert.Single(contents); + + Assert.Contains("internal interface INamedElement", content); + } + private static void CompareOutput(string expected, string actual) { string Normalize(string input) => Regex.Replace(input, @"[ \t]*\r\n", "\n");