-
Notifications
You must be signed in to change notification settings - Fork 331
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make property readonly when possible #3320
Conversation
src/DataCollectors/Microsoft.TestPlatform.Extensions.EventLogCollector/EventLogContainer.cs
Show resolved
Hide resolved
@@ -210,12 +210,12 @@ public DiscoveryCriteria DiscoveryCriteria | |||
/// <summary> | |||
/// Parent discovery manager | |||
/// </summary> | |||
internal IProxyDiscoveryManager DiscoveryManager { get; private set; } | |||
internal IProxyDiscoveryManager DiscoveryManager { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -102,7 +102,7 @@ public LazyExtension(Func<TExtension> creator, TMetadata metadata) | |||
/// </summary> | |||
internal bool IsExtensionCreated { get; private set; } | |||
|
|||
internal TestPluginInformation TestPluginInfo { get; private set; } | |||
internal TestPluginInformation TestPluginInfo { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
|
||
/// <summary> | ||
/// Gets the map of settings name to settings provider. | ||
/// </summary> | ||
public Dictionary<string, LazyExtension<ISettingsProvider, ISettingsProviderCapabilities>> SettingsProvidersMap { get; private set; } | ||
public Dictionary<string, LazyExtension<ISettingsProvider, ISettingsProviderCapabilities>> SettingsProvidersMap { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -66,7 +66,7 @@ public ParallelRunDataAggregator(string runSettingsXml) | |||
|
|||
public bool IsCanceled { get; private set; } | |||
|
|||
public string RunSettings { get; private set; } | |||
public string RunSettings { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -157,17 +179,17 @@ internal abstract class BaseRunTests | |||
/// <summary> | |||
/// Gets the run settings. | |||
/// </summary> | |||
protected string RunSettings { get; private set; } | |||
protected string RunSettings { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
|
||
/// <summary> | ||
/// Gets the test execution context. | ||
/// </summary> | ||
protected TestExecutionContext TestExecutionContext { get; private set; } | ||
protected TestExecutionContext TestExecutionContext { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
|
||
/// <summary> | ||
/// Gets the test run events handler. | ||
/// </summary> | ||
protected ITestRunEventsHandler TestRunEventsHandler { get; private set; } | ||
protected ITestRunEventsHandler TestRunEventsHandler { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -38,12 +38,12 @@ public TestLink(Guid id, string name, string storage) | |||
/// <summary> | |||
/// Gets the name. | |||
/// </summary> | |||
public string Name { get; private set; } = string.Empty; | |||
public string Name { get; } = string.Empty; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -113,7 +113,7 @@ public static TestListCategory AllResults | |||
/// <summary> | |||
/// Gets the id. | |||
/// </summary> | |||
public TestListCategoryId Id { get; private set; } = new TestListCategoryId(); | |||
public TestListCategoryId Id { get; } = new TestListCategoryId(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
|
||
/// <summary> | ||
/// Gets the class name. | ||
/// </summary> | ||
public string ClassName { get; private set; } | ||
public string ClassName { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -297,7 +297,7 @@ public TimeSpan Duration | |||
/// <summary> | |||
/// Gets the computer name. | |||
/// </summary> | |||
public string ComputerName { get; private set; } | |||
public string ComputerName { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -408,7 +408,7 @@ public string TestResultsDirectory | |||
/// <summary> | |||
/// Gets the directory containing the test result files, relative to the root results directory | |||
/// </summary> | |||
public string RelativeTestResultsDirectory { get; private set; } | |||
public string RelativeTestResultsDirectory { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -51,7 +51,7 @@ public override TestType TestType | |||
/// <summary> | |||
/// Gets the test method. | |||
/// </summary> | |||
public TestMethod TestMethod { get; private set; } | |||
public TestMethod TestMethod { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -77,7 +77,7 @@ internal static ArgumentProcessorFactory Create() | |||
/// <summary> | |||
/// Returns all of the available argument processors. | |||
/// </summary> | |||
public IEnumerable<IArgumentProcessor> AllArgumentProcessors { get; private set; } | |||
public IEnumerable<IArgumentProcessor> AllArgumentProcessors { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -60,7 +60,7 @@ internal string TraceFileName | |||
/// <value> | |||
/// The <see cref="StreamWriterRollingHelper"/> for the flat file. | |||
/// </value> | |||
internal StreamWriterRollingHelper RollingHelper { get; private set; } | |||
internal StreamWriterRollingHelper RollingHelper { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -20,7 +20,7 @@ public sealed class TestHostLaunchedEventArgs : DataCollectionEventArgs | |||
|
|||
#region Public properties | |||
|
|||
public int TestHostProcessId { get; private set; } | |||
public int TestHostProcessId { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -85,14 +85,14 @@ protected internal DataCollectionContext(SessionId sessionId, TestCase testCase) | |||
/// Identifies the session under which the data collection occurs. Will not be null. | |||
/// </summary> | |||
[DataMember] | |||
public SessionId SessionId { get; private set; } | |||
public SessionId SessionId { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
|
||
/// <summary> | ||
/// Identifies the test execution under which the data collection occurs, | ||
/// or null if no such test exists. | ||
/// </summary> | ||
[DataMember] | ||
public TestExecId TestExecId { get; private set; } | ||
public TestExecId TestExecId { get; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was badly refactored by the code-fix because the field was not readonly.
@@ -85,14 +85,14 @@ protected internal DataCollectionContext(SessionId sessionId, TestCase testCase) | |||
/// Identifies the session under which the data collection occurs. Will not be null. | |||
/// </summary> | |||
[DataMember] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
REVIEW ME: Changes on this type are related to some DataMember
so there might have been some impact on serialization although this doesn't seem to be part of any old serialization path (XmlSerializer).
Not sure what is required of me in this PR. Should the lines marked as "incorrectly refactored" be reverted? Or what am I approving here? |
@nohwnd I have called out all cases where we used to have a readonly property (with a non-static field) before doing the big code style PR. Except for the case where there is a |
No description provided.