Skip to content

Commit 9b04165

Browse files
committed
Chaning struct fields to properties
1 parent 9dc1d3e commit 9b04165

File tree

1 file changed

+70
-36
lines changed

1 file changed

+70
-36
lines changed

src/Microsoft.VisualStudio.Jdt.Tests/JsonTransformationTestLogger.cs

Lines changed: 70 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -29,55 +29,106 @@ public class JsonTransformationTestLogger : IJsonTransformationLogger
2929
/// <inheritdoc/>
3030
public void LogError(string message)
3131
{
32-
this.ErrorLog.Add(new TestLogEntry(message, null, 0, 0, false));
32+
this.ErrorLog.Add(new TestLogEntry()
33+
{
34+
Message = message,
35+
FromException = false
36+
});
3337
}
3438

3539
/// <inheritdoc/>
3640
public void LogError(string message, string fileName, int lineNumber, int linePosition)
3741
{
38-
this.ErrorLog.Add(new TestLogEntry(message, fileName, lineNumber, linePosition, false));
42+
this.ErrorLog.Add(new TestLogEntry()
43+
{
44+
Message = message,
45+
FileName = fileName,
46+
LineNumber = lineNumber,
47+
LinePosition = linePosition,
48+
FromException = false
49+
});
3950
}
4051

4152
/// <inheritdoc/>
4253
public void LogErrorFromException(Exception ex)
4354
{
44-
this.ErrorLog.Add(new TestLogEntry(ex.Message, null, 0, 0, true));
55+
this.ErrorLog.Add(new TestLogEntry()
56+
{
57+
Message = ex.Message,
58+
FromException = false
59+
});
4560
}
4661

4762
/// <inheritdoc/>
4863
public void LogErrorFromException(Exception ex, string fileName, int lineNumber, int linePosition)
4964
{
50-
this.ErrorLog.Add(new TestLogEntry(ex.Message, fileName, lineNumber, linePosition, true));
65+
this.ErrorLog.Add(new TestLogEntry()
66+
{
67+
Message = ex.Message,
68+
FileName = fileName,
69+
LineNumber = lineNumber,
70+
LinePosition = linePosition,
71+
FromException = true
72+
});
5173
}
5274

5375
/// <inheritdoc/>
5476
public void LogMessage(string message)
5577
{
56-
this.MessageLog.Add(new TestLogEntry(message, null, 0, 0, false));
78+
this.MessageLog.Add(new TestLogEntry()
79+
{
80+
Message = message,
81+
FromException = false
82+
});
5783
}
5884

5985
/// <inheritdoc/>
6086
public void LogMessage(string message, string fileName, int lineNumber, int linePosition)
6187
{
62-
this.MessageLog.Add(new TestLogEntry(message, fileName, lineNumber, linePosition, false));
88+
this.MessageLog.Add(new TestLogEntry()
89+
{
90+
Message = message,
91+
FileName = fileName,
92+
LineNumber = lineNumber,
93+
LinePosition = linePosition,
94+
FromException = false
95+
});
6396
}
6497

6598
/// <inheritdoc/>
6699
public void LogWarning(string message)
67100
{
68-
this.WarningLog.Add(new TestLogEntry(message, null, 0, 0, false));
101+
this.WarningLog.Add(new TestLogEntry()
102+
{
103+
Message = message,
104+
FromException = false
105+
});
69106
}
70107

71108
/// <inheritdoc/>
72109
public void LogWarning(string message, string fileName)
73110
{
74-
this.WarningLog.Add(new TestLogEntry(message, fileName, 0, 0, false));
111+
this.WarningLog.Add(new TestLogEntry()
112+
{
113+
Message = message,
114+
FileName = fileName,
115+
LineNumber = 0,
116+
LinePosition = 0,
117+
FromException = false
118+
});
75119
}
76120

77121
/// <inheritdoc/>
78122
public void LogWarning(string message, string fileName, int lineNumber, int linePosition)
79123
{
80-
this.WarningLog.Add(new TestLogEntry(message, fileName, lineNumber, linePosition, false));
124+
this.WarningLog.Add(new TestLogEntry()
125+
{
126+
Message = message,
127+
FileName = fileName,
128+
LineNumber = lineNumber,
129+
LinePosition = linePosition,
130+
FromException = false
131+
});
81132
}
82133

83134
/// <summary>
@@ -87,46 +138,29 @@ public void LogWarning(string message, string fileName, int lineNumber, int line
87138
public struct TestLogEntry
88139
{
89140
/// <summary>
90-
/// The log message
91-
/// </summary>
92-
public string Message;
93-
94-
/// <summary>
95-
/// The file that caused the entry
141+
/// Gets or sets the log message
96142
/// </summary>
97-
public string FileName;
143+
public string Message { get; set; }
98144

99145
/// <summary>
100-
/// The line in the file
146+
/// Gets or sets the file that caused the entry
101147
/// </summary>
102-
public int LineNumber;
148+
public string FileName { get; set; }
103149

104150
/// <summary>
105-
/// The position in the line
151+
/// Gets or sets the line in the file
106152
/// </summary>
107-
public int LinePosition;
153+
public int LineNumber { get; set; }
108154

109155
/// <summary>
110-
/// Whether the entry was caused from an exception
156+
/// Gets or sets the position in the line
111157
/// </summary>
112-
public bool FromException;
158+
public int LinePosition { get; set; }
113159

114160
/// <summary>
115-
/// Initializes a new instance of the <see cref="TestLogEntry"/> struct.
161+
/// Gets or sets a value indicating whether whether the entry was caused from an exception
116162
/// </summary>
117-
/// <param name="message">The entry message</param>
118-
/// <param name="file">The file that caused the entry</param>
119-
/// <param name="lineNumber">The line in the file</param>
120-
/// <param name="linePosition">The position in the line</param>
121-
/// <param name="fromException">Whether the entry was caused by an exception</param>
122-
public TestLogEntry(string message, string file, int lineNumber, int linePosition, bool fromException)
123-
{
124-
this.Message = message;
125-
this.FileName = file;
126-
this.LineNumber = lineNumber;
127-
this.LinePosition = linePosition;
128-
this.FromException = fromException;
129-
}
163+
public bool FromException { get; set; }
130164
}
131165
}
132166
}

0 commit comments

Comments
 (0)