Addressing code review comments by making the Configuration class's fields readonly.

This commit is contained in:
Livar Cunha 2018-05-17 10:01:42 -07:00
parent 2a735db882
commit e5e2256ae9
3 changed files with 122 additions and 97 deletions

View file

@ -5,10 +5,20 @@ namespace Microsoft.DotNet.Configurer
{
public class DotnetFirstRunConfiguration
{
public bool GenerateAspNetCertificate { get; set; }
public bool GenerateAspNetCertificate { get; }
public bool PrintTelemetryMessage { get; set; }
public bool PrintTelemetryMessage { get; }
public bool SkipFirstRunExperience { get; set; }
public bool SkipFirstRunExperience { get; }
public DotnetFirstRunConfiguration(
bool generateAspNetCertificate,
bool printTelemetryMessage,
bool skipFirstRunExperience)
{
GenerateAspNetCertificate = generateAspNetCertificate;
PrintTelemetryMessage = printTelemetryMessage;
SkipFirstRunExperience = skipFirstRunExperience;
}
}
}

View file

@ -164,12 +164,10 @@ namespace Microsoft.DotNet.Cli
skipFirstRunExperience = false;
}
var dotnetFirstRunConfiguration = new DotnetFirstRunConfiguration
{
GenerateAspNetCertificate = generateAspNetCertificate,
PrintTelemetryMessage = printTelemetryMessage,
SkipFirstRunExperience = skipFirstRunExperience
};
var dotnetFirstRunConfiguration = new DotnetFirstRunConfiguration(
generateAspNetCertificate,
printTelemetryMessage,
skipFirstRunExperience);
ConfigureDotNetForFirstTimeUse(
nugetCacheSentinel,

View file

@ -49,10 +49,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -76,10 +77,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = true,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: true
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -103,10 +105,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = false
},
(
generateAspNetCertificate: true,
printTelemetryMessage: false,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -130,10 +133,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -157,10 +161,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -183,10 +188,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -209,10 +215,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -235,10 +242,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = true,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: true
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -261,10 +269,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -288,10 +297,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -318,10 +328,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -349,10 +360,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -376,11 +388,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true,
GenerateAspNetCertificate = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -404,10 +416,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -438,10 +451,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -464,10 +478,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -491,10 +506,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: true
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -518,10 +534,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true
},
(
generateAspNetCertificate: false,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -545,11 +562,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true,
GenerateAspNetCertificate = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -573,11 +590,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = false,
PrintTelemetryMessage = true,
GenerateAspNetCertificate = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: false
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);
@ -598,11 +615,11 @@ namespace Microsoft.DotNet.Configurer.UnitTests
_aspNetCoreCertificateGeneratorMock.Object,
_toolPathSentinelMock.Object,
new DotnetFirstRunConfiguration
{
SkipFirstRunExperience = true,
PrintTelemetryMessage = true,
GenerateAspNetCertificate = true
},
(
generateAspNetCertificate: true,
printTelemetryMessage: true,
skipFirstRunExperience: true
),
_reporterMock.Object,
CliFallbackFolderPath,
_pathAdderMock.Object);