Skip to content

Commit f9a18eb

Browse files
committed
Improve coverage
1 parent 45c2afa commit f9a18eb

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

XmlSchemaClassGenerator/IXmlSchemaNode.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@ namespace XmlSchemaClassGenerator
55
{
66
public interface IXmlSchemaNode
77
{
8-
string Name { get; }
8+
//string Name { get; }
99
string DefaultValue { get; }
1010
string FixedValue { get; }
1111
XmlSchemaForm Form { get; }
1212
XmlQualifiedName QualifiedName { get; }
1313
XmlQualifiedName RefName { get; }
14-
XmlSchemaType SchemaType { get; }
15-
XmlSchemaType NodeSchemaType { get; }
16-
XmlQualifiedName SchemaTypeName { get; }
14+
//XmlQualifiedName SchemaTypeName { get; }
15+
//XmlSchemaType SchemaType { get; }
16+
//XmlSchemaType NodeSchemaType { get; }
1717

1818
XmlSchemaAnnotated Base { get; }
1919
XmlSchemaForm FormDefault { get; }
@@ -25,23 +25,23 @@ public sealed class XmlSchemaAttributeEx : IXmlSchemaNode
2525

2626
public XmlSchemaAttribute Real { get; }
2727

28-
public string Name => Real.Name;
28+
//public string Name => Real.Name;
2929
public string DefaultValue => Real.DefaultValue;
3030
public string FixedValue => Real.FixedValue;
3131
public XmlSchemaForm Form => Real.Form;
3232
public XmlQualifiedName QualifiedName => Real.QualifiedName;
3333
public XmlQualifiedName RefName => Real.RefName;
34-
public XmlQualifiedName SchemaTypeName => Real.SchemaTypeName;
35-
public XmlSchemaSimpleType SchemaType => Real.SchemaType;
34+
//public XmlQualifiedName SchemaTypeName => Real.SchemaTypeName;
35+
//public XmlSchemaSimpleType SchemaType => Real.SchemaType;
3636
public XmlSchemaSimpleType AttributeSchemaType => Real.AttributeSchemaType;
3737

3838
public XmlSchemaAnnotated Base => Real;
3939

4040
public XmlSchemaForm FormDefault => Base.GetSchema().AttributeFormDefault;
4141

42-
XmlSchemaType IXmlSchemaNode.SchemaType => SchemaType;
42+
//XmlSchemaType IXmlSchemaNode.SchemaType => SchemaType;
4343

44-
XmlSchemaType IXmlSchemaNode.NodeSchemaType => AttributeSchemaType;
44+
//XmlSchemaType IXmlSchemaNode.NodeSchemaType => AttributeSchemaType;
4545

4646
public XmlSchemaUse Use => Real.Use;
4747

@@ -55,23 +55,23 @@ public sealed class XmlSchemaElementEx : IXmlSchemaNode
5555

5656
public XmlSchemaElement Real { get; }
5757

58-
public string Name => Real.Name;
58+
//public string Name => Real.Name;
5959
public string DefaultValue => Real.DefaultValue;
6060
public string FixedValue => Real.FixedValue;
6161
public XmlSchemaForm Form => Real.Form;
6262
public XmlQualifiedName QualifiedName => Real.QualifiedName;
6363
public XmlQualifiedName RefName => Real.RefName;
64-
public XmlQualifiedName SchemaTypeName => Real.SchemaTypeName;
65-
public XmlSchemaType SchemaType => Real.SchemaType;
64+
//public XmlQualifiedName SchemaTypeName => Real.SchemaTypeName;
65+
//public XmlSchemaType SchemaType => Real.SchemaType;
6666
public XmlSchemaType ElementSchemaType => Real.ElementSchemaType;
6767

6868
public XmlSchemaAnnotated Base => Real;
6969

7070
public XmlSchemaForm FormDefault => Base.GetSchema().ElementFormDefault;
7171

72-
XmlSchemaType IXmlSchemaNode.SchemaType => SchemaType;
72+
//XmlSchemaType IXmlSchemaNode.SchemaType => SchemaType;
7373

74-
XmlSchemaType IXmlSchemaNode.NodeSchemaType => ElementSchemaType;
74+
//XmlSchemaType IXmlSchemaNode.NodeSchemaType => ElementSchemaType;
7575

7676
public bool IsNillable => Real.IsNillable;
7777

XmlSchemaClassGenerator/ModelBuilder.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -755,9 +755,9 @@ private IEnumerable<PropertyModel> CreatePropertiesForAttributes(Uri source, Typ
755755

756756
foreach (var item in items)
757757
{
758-
if (item is XmlSchemaAttribute node)
758+
if (item is XmlSchemaAttribute xs)
759759
{
760-
XmlSchemaAttributeEx attribute = node;
760+
XmlSchemaAttributeEx attribute = xs;
761761
if (attribute.Use != XmlSchemaUse.Prohibited)
762762
{
763763
var attributeQualifiedName = attribute.AttributeSchemaType.QualifiedName;
@@ -806,10 +806,10 @@ private IEnumerable<PropertyModel> CreatePropertiesForAttributes(Uri source, Typ
806806
var property = new PropertyModel(_configuration, name, typeModel, owningTypeModel)
807807
{
808808
IsAttribute = true,
809-
IsRequired = node.Use == XmlSchemaUse.Required
809+
IsRequired = attribute.Use == XmlSchemaUse.Required
810810
};
811811

812-
property.SetFromNode(originalName, () => node.Use != XmlSchemaUse.Optional, attribute);
812+
property.SetFromNode(originalName, () => attribute.Use != XmlSchemaUse.Optional, attribute);
813813
property.SetSchemaNameAndNamespace(owningTypeModel, attribute);
814814
property.Documentation.AddRange(GetDocumentation(attribute));
815815

@@ -865,17 +865,17 @@ private IEnumerable<PropertyModel> CreatePropertiesForElements(Uri source, TypeM
865865
if (item.XmlParticle is XmlSchemaElement xs && xs.ElementSchemaType != null)
866866
{
867867
XmlSchemaElementEx element = xs;
868-
XmlSchemaElementEx effectiveElement = substitute?.Element ?? xs;
868+
XmlSchemaElementEx effectiveElement = substitute?.Element ?? element;
869869
var name = _configuration.NamingProvider.ElementNameFromQualifiedName(effectiveElement.QualifiedName, effectiveElement);
870870
var originalName = name;
871871
if (name == owningTypeModel.Name)
872872
name += "Property"; // member names cannot be the same as their enclosing type
873873

874874
name = owningTypeModel.GetUniquePropertyName(name);
875875

876-
var typeModel = substitute?.Type ?? CreateTypeModel(GetQualifiedName(owningTypeModel, xmlParticle, xs), xs.ElementSchemaType);
876+
var typeModel = substitute?.Type ?? CreateTypeModel(GetQualifiedName(owningTypeModel, xmlParticle, element), element.ElementSchemaType);
877877

878-
property = new PropertyModel(_configuration, name, typeModel, owningTypeModel) { IsNillable = xs.IsNillable };
878+
property = new PropertyModel(_configuration, name, typeModel, owningTypeModel) { IsNillable = element.IsNillable };
879879
property.SetFromParticles(particle, item);
880880
property.SetFromNode(originalName, () => item.MinOccurs >= 1.0m && item.XmlParent is not XmlSchemaChoice, element);
881881
property.SetSchemaNameAndNamespace(owningTypeModel, effectiveElement);

0 commit comments

Comments
 (0)