Skip to content

Commit 9b0c253

Browse files
committed
Removed redundant comments
1 parent 205cde7 commit 9b0c253

File tree

6 files changed

+5
-100
lines changed

6 files changed

+5
-100
lines changed

Serilog.Sinks.RichTextBox.WinForms.Colored.Test/Collections/ConcurrentCircularBufferTests.cs

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,47 +8,40 @@ public class ConcurrentCircularBufferTests
88
[Fact]
99
public void TakeSnapshot_WithItemsLessThanCapacity_ReturnsAllItemsInOrder()
1010
{
11-
// Arrange
1211
var buffer = new ConcurrentCircularBuffer<int>(3);
1312
buffer.Add(1);
1413
buffer.Add(2);
1514

16-
// Act
1715
var snapshot = new List<int>();
1816
buffer.TakeSnapshot(snapshot);
1917

20-
// Assert
2118
Assert.Equal(new[] { 1, 2 }, snapshot);
2219
}
2320

2421
[Fact]
2522
public void AddBeyondCapacity_OverwritesOldestItemsAndMaintainsOrder()
2623
{
27-
// Arrange
2824
var buffer = new ConcurrentCircularBuffer<int>(3);
2925
buffer.Add(1);
3026
buffer.Add(2);
3127
buffer.Add(3);
3228
buffer.Add(4); // Should overwrite the oldest item (1)
3329

34-
// Act
3530
var snapshot = new List<int>();
3631
buffer.TakeSnapshot(snapshot);
3732

38-
// Assert
3933
Assert.Equal(new[] { 2, 3, 4 }, snapshot);
4034
}
4135

4236
[Fact]
4337
public void Clear_FollowedByAdds_SnapshotContainsOnlyNewItems()
4438
{
45-
// Arrange
4639
var buffer = new ConcurrentCircularBuffer<int>(3);
4740
buffer.Add(1);
4841
buffer.Add(2);
4942
buffer.Add(3);
5043

51-
// Act & Assert - After clear, snapshot should be empty
44+
// After clear, snapshot should be empty
5245
buffer.Clear();
5346
var snapshotAfterClear = new List<int>();
5447
buffer.TakeSnapshot(snapshotAfterClear);
@@ -71,7 +64,6 @@ public void Clear_FollowedByAdds_SnapshotContainsOnlyNewItems()
7164
[Fact]
7265
public void Restore_AfterClear_ReturnsAllItemsAgain()
7366
{
74-
// Arrange
7567
var buffer = new ConcurrentCircularBuffer<int>(3);
7668
buffer.Add(1);
7769
buffer.Add(2);
@@ -82,12 +74,11 @@ public void Restore_AfterClear_ReturnsAllItemsAgain()
8274
buffer.Add(4);
8375
buffer.Add(5);
8476

85-
// Act - Restore should make all items visible again
77+
// Restore should make all items visible again
8678
buffer.Restore();
8779
var snapshot = new List<int>();
8880
buffer.TakeSnapshot(snapshot);
8981

90-
// Assert
9182
Assert.Equal(new[] { 3, 4, 5 }, snapshot);
9283
}
9384
}

Serilog.Sinks.RichTextBox.WinForms.Colored.Test/Integration/BasicFormattingTests.cs

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ public void Constructor_InitializesRichTextBoxCorrectly()
1717
[Fact]
1818
public void Emit_WithScalarValues_FormatsCorrectly()
1919
{
20-
// Arrange
2120
var template = _parser.Parse("String value: {String}");
2221
var logEvent = new LogEvent(
2322
DateTimeOffset.Now,
@@ -26,18 +25,15 @@ public void Emit_WithScalarValues_FormatsCorrectly()
2625
template,
2726
new[] { new LogEventProperty("String", new ScalarValue("test")) });
2827

29-
// Act
3028
_renderer.Render(logEvent, _canvas);
3129

32-
// Assert
3330
var text = _richTextBox.Text;
3431
Assert.Contains("String value: test", text);
3532
}
3633

3734
[Fact]
3835
public void Emit_WithDictionaryValue_FormatsCorrectly()
3936
{
40-
// Arrange
4137
var dict = new Dictionary<string, object>
4238
{
4339
["key1"] = "value1",
@@ -59,10 +55,8 @@ public void Emit_WithDictionaryValue_FormatsCorrectly()
5955
template,
6056
new[] { new LogEventProperty("Dict", dictValue) });
6157

62-
// Act
6358
_renderer.Render(logEvent, _canvas);
6459

65-
// Assert
6660
var text = _richTextBox.Text;
6761
Assert.Contains("Dictionary: {", text);
6862
Assert.Contains("[key1]=value1", text);
@@ -72,7 +66,6 @@ public void Emit_WithDictionaryValue_FormatsCorrectly()
7266
[Fact]
7367
public void Emit_WithSequenceValue_FormatsCorrectly()
7468
{
75-
// Arrange
7669
var array = new object[] { 1, 2, 3, "test" };
7770
var sequenceValue = new SequenceValue(array.Select(x => new ScalarValue(x)));
7871

@@ -84,10 +77,8 @@ public void Emit_WithSequenceValue_FormatsCorrectly()
8477
template,
8578
new[] { new LogEventProperty("Array", sequenceValue) });
8679

87-
// Act
8880
_renderer.Render(logEvent, _canvas);
8981

90-
// Assert
9182
var text = _richTextBox.Text;
9283
Assert.Contains("Array: [", text);
9384
Assert.Contains("1, 2, 3, test", text);
@@ -96,7 +87,6 @@ public void Emit_WithSequenceValue_FormatsCorrectly()
9687
[Fact]
9788
public void Emit_WithStructureValue_FormatsCorrectly()
9889
{
99-
// Arrange
10090
var structureValue = new StructureValue(new[]
10191
{
10292
new LogEventProperty("Name", new ScalarValue("Test")),
@@ -112,10 +102,8 @@ public void Emit_WithStructureValue_FormatsCorrectly()
112102
template,
113103
new[] { new LogEventProperty("Object", structureValue) });
114104

115-
// Act
116105
_renderer.Render(logEvent, _canvas);
117106

118-
// Assert
119107
var text = _richTextBox.Text;
120108
Assert.Contains("Object: {", text);
121109
Assert.Contains("Name=Test", text);
@@ -126,7 +114,6 @@ public void Emit_WithStructureValue_FormatsCorrectly()
126114
[Fact]
127115
public void Emit_WithComplexNestedValue_FormatsCorrectly()
128116
{
129-
// Arrange
130117
var complex = new StructureValue(new[]
131118
{
132119
new LogEventProperty("Name", new ScalarValue("Test")),
@@ -146,10 +133,8 @@ public void Emit_WithComplexNestedValue_FormatsCorrectly()
146133
template,
147134
new[] { new LogEventProperty("Complex", complex) });
148135

149-
// Act
150136
_renderer.Render(logEvent, _canvas);
151137

152-
// Assert
153138
var text = _richTextBox.Text;
154139
Assert.Contains("Complex: {", text);
155140
Assert.Contains("Name=Test", text);
@@ -162,7 +147,6 @@ public void Emit_WithComplexNestedValue_FormatsCorrectly()
162147
[Fact]
163148
public void Emit_WithSequenceValue_JsonFormatting_FormatsCorrectly()
164149
{
165-
// Arrange
166150
var array = new object[] { 1, 2, 3, "test" };
167151
var sequenceValue = new SequenceValue(array.Select(x => new ScalarValue(x)));
168152

@@ -174,10 +158,8 @@ public void Emit_WithSequenceValue_JsonFormatting_FormatsCorrectly()
174158
template,
175159
new[] { new LogEventProperty("Array", sequenceValue) });
176160

177-
// Act
178161
_renderer.Render(logEvent, _canvas);
179162

180-
// Assert
181163
var text = _richTextBox.Text;
182164
Assert.Contains("Array: [", text);
183165
Assert.Contains("1, 2, 3, \"test\"", text);
@@ -186,7 +168,6 @@ public void Emit_WithSequenceValue_JsonFormatting_FormatsCorrectly()
186168
[Fact]
187169
public void Emit_WithNestedSequenceValue_JsonFormatting_FormatsCorrectly()
188170
{
189-
// Arrange
190171
var nestedArray = new object[] { new object[] { 1, 2 }, new object[] { 3, 4 } };
191172
var sequenceValue = new SequenceValue(nestedArray.Select(x =>
192173
new SequenceValue(((object[])x).Select(y => new ScalarValue(y)))));
@@ -199,10 +180,8 @@ public void Emit_WithNestedSequenceValue_JsonFormatting_FormatsCorrectly()
199180
template,
200181
new[] { new LogEventProperty("NestedArray", sequenceValue) });
201182

202-
// Act
203183
_renderer.Render(logEvent, _canvas);
204184

205-
// Assert
206185
var text = _richTextBox.Text;
207186
Assert.Contains("NestedArray: [", text);
208187
Assert.Contains("[[1, 2], [3, 4]]", text);
@@ -211,7 +190,6 @@ public void Emit_WithNestedSequenceValue_JsonFormatting_FormatsCorrectly()
211190
[Fact]
212191
public void Emit_WithEmptySequenceValue_JsonFormatting_FormatsCorrectly()
213192
{
214-
// Arrange
215193
var emptyArray = new object[] { };
216194
var sequenceValue = new SequenceValue(emptyArray.Select(x => new ScalarValue(x)));
217195

@@ -223,18 +201,15 @@ public void Emit_WithEmptySequenceValue_JsonFormatting_FormatsCorrectly()
223201
template,
224202
new[] { new LogEventProperty("EmptyArray", sequenceValue) });
225203

226-
// Act
227204
_renderer.Render(logEvent, _canvas);
228205

229-
// Assert
230206
var text = _richTextBox.Text;
231207
Assert.Contains("EmptyArray: []", text);
232208
}
233209

234210
[Fact]
235211
public void Emit_WithStructureValue_JsonFormatting_FormatsCorrectly()
236212
{
237-
// Arrange
238213
var structureValue = new StructureValue(new[]
239214
{
240215
new LogEventProperty("Name", new ScalarValue("Test")),
@@ -250,10 +225,8 @@ public void Emit_WithStructureValue_JsonFormatting_FormatsCorrectly()
250225
template,
251226
new[] { new LogEventProperty("Object", structureValue) });
252227

253-
// Act
254228
_renderer.Render(logEvent, _canvas);
255229

256-
// Assert
257230
var text = _richTextBox.Text;
258231
Assert.Contains("Object: {", text);
259232
Assert.Contains("\"Name\": \"Test\"", text);
@@ -264,7 +237,6 @@ public void Emit_WithStructureValue_JsonFormatting_FormatsCorrectly()
264237
[Fact]
265238
public void Emit_WithStructureValueWithTypeTag_JsonFormatting_FormatsCorrectly()
266239
{
267-
// Arrange
268240
var structureValue = new StructureValue(
269241
new[]
270242
{
@@ -281,10 +253,8 @@ public void Emit_WithStructureValueWithTypeTag_JsonFormatting_FormatsCorrectly()
281253
template,
282254
new[] { new LogEventProperty("Object", structureValue) });
283255

284-
// Act
285256
_renderer.Render(logEvent, _canvas);
286257

287-
// Assert
288258
var text = _richTextBox.Text;
289259
Assert.Contains("Object: {", text);
290260
Assert.Contains("\"Name\": \"Test\"", text);
@@ -295,9 +265,7 @@ public void Emit_WithStructureValueWithTypeTag_JsonFormatting_FormatsCorrectly()
295265
[Fact]
296266
public void Emit_WithEmptyStructureValue_JsonFormatting_FormatsCorrectly()
297267
{
298-
// Arrange
299268
var structureValue = new StructureValue(Array.Empty<LogEventProperty>());
300-
301269
var template = _parser.Parse("Object: {@Object:j}");
302270
var logEvent = new LogEvent(
303271
DateTimeOffset.Now,
@@ -306,10 +274,8 @@ public void Emit_WithEmptyStructureValue_JsonFormatting_FormatsCorrectly()
306274
template,
307275
new[] { new LogEventProperty("Object", structureValue) });
308276

309-
// Act
310277
_renderer.Render(logEvent, _canvas);
311278

312-
// Assert
313279
var text = _richTextBox.Text;
314280
Assert.Contains("Object: {}", text);
315281
}

Serilog.Sinks.RichTextBox.WinForms.Colored.Test/Integration/PropertiesTokenRendererTests.cs

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ public class PropertiesTokenRendererTests : RichTextBoxSinkTestBase
1010
[Fact]
1111
public void Render_WithAdditionalProperties_FormatsCorrectly()
1212
{
13-
// Arrange
1413
var template = _parser.Parse("Message: {Message}");
1514
var outputTemplate = _parser.Parse("Message: {Message} {Properties}");
1615
var token = outputTemplate.Tokens.OfType<PropertyToken>().Single(t => t.PropertyName == "Properties");
@@ -27,10 +26,8 @@ public void Render_WithAdditionalProperties_FormatsCorrectly()
2726
new LogEventProperty("Additional", new ScalarValue("value"))
2827
});
2928

30-
// Act
3129
renderer.Render(logEvent, _canvas);
3230

33-
// Assert
3431
var text = _richTextBox.Text;
3532
Assert.Contains("Additional=\"value\"", text);
3633
Assert.DoesNotContain("Message=\"test\"", text);
@@ -39,7 +36,6 @@ public void Render_WithAdditionalProperties_FormatsCorrectly()
3936
[Fact]
4037
public void Render_WithJsonFormatting_FormatsCorrectly()
4138
{
42-
// Arrange
4339
var template = _parser.Parse("Message: {Message}");
4440
var outputTemplate = _parser.Parse("Message: {Message} {Properties:j}");
4541
var token = outputTemplate.Tokens.OfType<PropertyToken>().Single(t => t.PropertyName == "Properties");
@@ -57,10 +53,8 @@ public void Render_WithJsonFormatting_FormatsCorrectly()
5753
new LogEventProperty("Boolean", new ScalarValue(true))
5854
});
5955

60-
// Act
6156
renderer.Render(logEvent, _canvas);
6257

63-
// Assert
6458
var text = _richTextBox.Text;
6559
Assert.Contains("\"Number\": 42", text);
6660
Assert.Contains("\"Boolean\": true", text);
@@ -70,7 +64,6 @@ public void Render_WithJsonFormatting_FormatsCorrectly()
7064
[Fact]
7165
public void Render_WithNestedProperties_FormatsCorrectly()
7266
{
73-
// Arrange
7467
var template = _parser.Parse("Message: {Message}");
7568
var outputTemplate = _parser.Parse("Message: {Message} {Properties}");
7669
var token = outputTemplate.Tokens.OfType<PropertyToken>().Single(t => t.PropertyName == "Properties");
@@ -92,10 +85,8 @@ public void Render_WithNestedProperties_FormatsCorrectly()
9285
new LogEventProperty("Nested", nestedStructure)
9386
});
9487

95-
// Act
9688
renderer.Render(logEvent, _canvas);
9789

98-
// Assert
9990
var text = _richTextBox.Text;
10091
Assert.Contains("Nested={", text);
10192
Assert.Contains("NestedValue=\"nested\"", text);
@@ -104,7 +95,6 @@ public void Render_WithNestedProperties_FormatsCorrectly()
10495
[Fact]
10596
public void Render_WithNoAdditionalProperties_FormatsCorrectly()
10697
{
107-
// Arrange
10898
var template = _parser.Parse("Message: {Message}");
10999
var outputTemplate = _parser.Parse("Message: {Message} {Properties}");
110100
var token = outputTemplate.Tokens.OfType<PropertyToken>().Single(t => t.PropertyName == "Properties");
@@ -120,18 +110,15 @@ public void Render_WithNoAdditionalProperties_FormatsCorrectly()
120110
new LogEventProperty("Message", new ScalarValue("test"))
121111
});
122112

123-
// Act
124113
renderer.Render(logEvent, _canvas);
125114

126-
// Assert
127115
var text = _richTextBox.Text;
128116
Assert.Equal("{}", text);
129117
}
130118

131119
[Fact]
132120
public void Render_WithPropertiesInOutputTemplate_ExcludesThem()
133121
{
134-
// Arrange
135122
var template = _parser.Parse("Message: {Message}");
136123
var outputTemplate = _parser.Parse("Message: {Message} {Properties} {Custom}");
137124
var token = outputTemplate.Tokens.OfType<PropertyToken>().Single(t => t.PropertyName == "Properties");
@@ -149,10 +136,8 @@ public void Render_WithPropertiesInOutputTemplate_ExcludesThem()
149136
new LogEventProperty("Additional", new ScalarValue("extra"))
150137
});
151138

152-
// Act
153139
renderer.Render(logEvent, _canvas);
154140

155-
// Assert
156141
var text = _richTextBox.Text;
157142
Assert.Contains("Additional=\"extra\"", text);
158143
Assert.DoesNotContain("Custom=\"value\"", text);

Serilog.Sinks.RichTextBox.WinForms.Colored.Test/Integration/SinkLifecycleTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ public void Dispose_CancelsMessageProcessing()
2222

2323
try
2424
{
25-
// Act & Assert
2625
testSink.Dispose();
26+
2727
// Give the background thread time to complete
2828
Thread.Sleep(100);
2929
Assert.Throws<ObjectDisposedException>(() => testSink.Emit(new LogEvent(

0 commit comments

Comments
 (0)