Visitor fixes (#4217)
This commit is contained in:
Родитель
9961dbefaa
Коммит
1fba540387
|
@ -96,17 +96,17 @@ namespace Microsoft.Generator.CSharp
|
||||||
|
|
||||||
protected internal virtual TypeProvider? Visit(InputModelType model, TypeProvider? type)
|
protected internal virtual TypeProvider? Visit(InputModelType model, TypeProvider? type)
|
||||||
{
|
{
|
||||||
return new ModelProvider(model);
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal virtual PropertyProvider? Visit(InputModelProperty property, PropertyProvider? propertyProvider)
|
protected internal virtual PropertyProvider? Visit(InputModelProperty property, PropertyProvider? propertyProvider)
|
||||||
{
|
{
|
||||||
return new PropertyProvider(property);
|
return propertyProvider;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal virtual TypeProvider? Visit(InputEnumType enumType, TypeProvider? type)
|
protected internal virtual TypeProvider? Visit(InputEnumType enumType, TypeProvider? type)
|
||||||
{
|
{
|
||||||
return EnumProvider.Create(enumType, type);
|
return type;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual TypeProvider? Visit(TypeProvider type)
|
protected virtual TypeProvider? Visit(TypeProvider type)
|
||||||
|
|
|
@ -206,7 +206,7 @@ namespace Microsoft.Generator.CSharp
|
||||||
}
|
}
|
||||||
foreach (var visitor in Visitors)
|
foreach (var visitor in Visitors)
|
||||||
{
|
{
|
||||||
type = visitor.Visit(enumType, declaringType);
|
type = visitor.Visit(enumType, type);
|
||||||
}
|
}
|
||||||
return type;
|
return type;
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ namespace Microsoft.Generator.CSharp.Tests
|
||||||
|
|
||||||
_mockVisitor.Protected().Verify<TypeProvider>("Visit", Times.Once(), inputModel, ItExpr.Is<ModelProvider>(m => m.Name == new ModelProvider(inputModel).Name));
|
_mockVisitor.Protected().Verify<TypeProvider>("Visit", Times.Once(), inputModel, ItExpr.Is<ModelProvider>(m => m.Name == new ModelProvider(inputModel).Name));
|
||||||
|
|
||||||
_mockVisitor.Protected().Verify<TypeProvider>("Visit", Times.Once(), inputEnum, ItExpr.IsNull<EnumProvider>());
|
_mockVisitor.Protected().Verify<TypeProvider>("Visit", Times.Once(), inputEnum, ItExpr.Is<EnumProvider>(m => m.Name == EnumProvider.Create(inputEnum, null).Name));
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@ -117,7 +117,7 @@ namespace Microsoft.Generator.CSharp.Tests
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
return base.Visit(inputModelProperty, propertyProvider);
|
return new PropertyProvider(inputModelProperty);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче