fixed bool literals in default method parameters
This commit is contained in:
@@ -194,7 +194,7 @@ namespace InterfaceGenerator.Tests
|
||||
method.ReturnType.Should().Be(typeof(void));
|
||||
|
||||
var parameters = method.GetParameters();
|
||||
parameters.Should().HaveCount(5);
|
||||
parameters.Should().HaveCount(7);
|
||||
parameters.Select(x => x.IsOptional).Should().AllBeEquivalentTo(true);
|
||||
|
||||
parameters[0].DefaultValue.Should().Be("cGFyYW0=");
|
||||
@@ -202,6 +202,8 @@ namespace InterfaceGenerator.Tests
|
||||
parameters[2].DefaultValue.Should().Be(0.1f);
|
||||
parameters[3].DefaultValue.Should().Be(0.2d);
|
||||
parameters[4].DefaultValue.Should().Be(0.3d);
|
||||
parameters[5].DefaultValue.Should().Be(true);
|
||||
parameters[6].DefaultValue.Should().Be(false);
|
||||
|
||||
_sut.VoidMethodWithOptionalParams();
|
||||
}
|
||||
@@ -283,7 +285,9 @@ namespace InterfaceGenerator.Tests
|
||||
string stringConstant = StringConstant,
|
||||
float floatLiteral = 0.1f,
|
||||
double doubleLiteral = 0.2,
|
||||
decimal decimalLiteral = 0.3m)
|
||||
decimal decimalLiteral = 0.3m,
|
||||
bool trueLiteral = true,
|
||||
bool falseLiteral = false)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
|
||||
namespace InterfaceGenerator
|
||||
namespace InterfaceGenerator
|
||||
{
|
||||
|
||||
internal class Attributes
|
||||
|
||||
@@ -336,6 +336,9 @@ namespace InterfaceGenerator
|
||||
case nameof(Decimal):
|
||||
writer.Write(" = {0}m", param.ExplicitDefaultValue);
|
||||
break;
|
||||
case nameof(Boolean):
|
||||
writer.Write(" = {0}", param.ExplicitDefaultValue.ToString().ToLower());
|
||||
break;
|
||||
default:
|
||||
writer.Write(" = {0}", param.ExplicitDefaultValue);
|
||||
break;
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<TargetFramework>netstandard2.1</TargetFramework>
|
||||
<LangVersion>9.0</LangVersion>
|
||||
<Nullable>enable</Nullable>
|
||||
<PackageVersion>1.0.3</PackageVersion>
|
||||
<PackageVersion>1.0.4</PackageVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
||||
Reference in New Issue
Block a user