Skip to content

Commit 46adf55

Browse files
format
1 parent 5758487 commit 46adf55

109 files changed

Lines changed: 475 additions & 389 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Common.Converter/BooleanToVisibilityConverter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ namespace Common.Converter
2121
/// Boolean to Visibility converter.
2222
/// </summary>
2323
/// <seealso cref="T:System.Windows.Data.IValueConverter" />
24-
public class BooleanToVisibilityConverter : IValueConverter
24+
public sealed class BooleanToVisibilityConverter : IValueConverter
2525
{
2626
/// <summary>
2727
/// Gets or sets a value indicating whether this <see cref="BooleanToVisibilityConverter"/> is collapse.

Common.ExtendedObject.Tests/BiMapTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,9 @@ public void Add_ValidPair_AddsToBothSides()
3535
[ExpectedException(typeof(ArgumentException))]
3636
public void Add_DuplicateValue_ThrowsException()
3737
{
38-
var map = new BiMap<string> { { "A", "Shared" }, { "B", "Shared" } // This should trigger your duplicate check
38+
var map = new BiMap<string>
39+
{
40+
{ "A", "Shared" }, { "B", "Shared" } // This should trigger your duplicate check
3941
};
4042
}
4143

Common.ExtendedObject.Tests/UnmanagedIntListTests.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,7 @@ public void BenchmarkAddPerformance()
313313
{
314314
list.Add(i);
315315
}
316+
316317
swList.Stop();
317318

318319
// CLEAN SLATE AGAIN
@@ -326,6 +327,7 @@ public void BenchmarkAddPerformance()
326327
{
327328
unmanaged.Add(i);
328329
}
330+
329331
swUnmanaged.Stop();
330332

331333
Trace.WriteLine($"List<int>.Add: {swList.ElapsedMilliseconds} ms");
@@ -334,7 +336,7 @@ public void BenchmarkAddPerformance()
334336
unmanaged.Dispose();
335337

336338
// 5. RELAX TOLERANCE: Native heap allocation variance can easily be 20x slower than the CLR
337-
long maxAllowedTime = swList.ElapsedMilliseconds * 25;
339+
var maxAllowedTime = swList.ElapsedMilliseconds * 25;
338340
Assert.IsTrue(swUnmanaged.ElapsedMilliseconds <= maxAllowedTime,
339341
$"UnmanagedIntList.Add is too slow. Actual: {swUnmanaged.ElapsedMilliseconds} ms, Allowed Max: {maxAllowedTime} ms.");
340342
}

Common.ExtendedObject.Tests/UnmanagedMapTests.cs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ public void BenchmarkInsertCompareWithDictionary_Stable()
155155
const int iterations = 100_000;
156156
const int sampleRuns = 3; // Sample multiple iterations to filter out OS context switching
157157

158-
double bestDictMs = double.MaxValue;
159-
double bestMapMs = double.MaxValue;
158+
var bestDictMs = double.MaxValue;
159+
var bestMapMs = double.MaxValue;
160160

161161
// We execute multiple loops and track the *minimum* time recorded to eliminate environmental spikes
162-
for (int run = 0; run < sampleRuns; run++)
162+
for (var run = 0; run < sampleRuns; run++)
163163
{
164164
var dict = new Dictionary<int, int>(iterations);
165165
var map = new UnmanagedMap<int>(18); // 2^17
@@ -180,6 +180,7 @@ public void BenchmarkInsertCompareWithDictionary_Stable()
180180
{
181181
dict[i] = i;
182182
}
183+
183184
swDict.Stop();
184185

185186
if (swDict.Elapsed.TotalMilliseconds < bestDictMs)
@@ -193,6 +194,7 @@ public void BenchmarkInsertCompareWithDictionary_Stable()
193194
{
194195
map.Set(i, i);
195196
}
197+
196198
swMap.Stop();
197199

198200
if (swMap.Elapsed.TotalMilliseconds < bestMapMs)
@@ -210,7 +212,7 @@ public void BenchmarkInsertCompareWithDictionary_Stable()
210212

211213
// Fail-safe defense evaluation:
212214
// Pass if the ratio remains healthy (under 20x) OR if the total operation speed is objectively exceptional (under 40ms)
213-
bool isPerformanceAcceptable = ratio < 20.0 || bestMapMs < 40.0;
215+
var isPerformanceAcceptable = ratio < 20.0 || bestMapMs < 40.0;
214216

215217
Assert.IsTrue(isPerformanceAcceptable,
216218
$"UnmanagedMap insert performance threshold violated. Best Ratio: {ratio:F2}, Best Map Time: {bestMapMs:F3} ms");

Common.ExtendedObject.Tests/UnmanagedMemoryHelperTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ public void Allocate_Reallocate_Free_Memory()
2626
const int count = 10;
2727

2828
// 1. Allocate directly to a strongly-typed int*
29-
int* ptr = (int*)UnmanagedMemoryHelper.Allocate<int>(count);
29+
var ptr = (int*)UnmanagedMemoryHelper.Allocate<int>(count);
3030
Assert.IsTrue(ptr != null, "Allocation failed; pointer is null.");
3131

3232
try
@@ -39,7 +39,7 @@ public void Allocate_Reallocate_Free_Memory()
3939

4040
// Reallocate to a bigger size
4141
const int newCount = 20;
42-
int* newPtr = UnmanagedMemoryHelper.Reallocate<int>(ptr, newCount);
42+
var newPtr = UnmanagedMemoryHelper.Reallocate<int>(ptr, newCount);
4343
Assert.IsTrue(newPtr != null, "Reallocation failed; pointer is null.");
4444
ptr = newPtr;
4545

@@ -75,7 +75,7 @@ public void Allocate_Reallocate_Free_Memory()
7575
public void Clear_SetsMemoryToZero()
7676
{
7777
const int count = 5;
78-
int* ptr = (int*)UnmanagedMemoryHelper.Allocate<int>(count);
78+
var ptr = (int*)UnmanagedMemoryHelper.Allocate<int>(count);
7979

8080
try
8181
{

CommonLibraryGui.Tests/BitmapComparisonTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public void CompareRenderingSpeeds()
7878
TestContext.WriteLine($"NativeBitmapDisplay Average Time: {nativeDisplayTime}ms");
7979

8080
// FIXED: Switched from strict 1ms addition to a percentage multiplier threshold
81-
double maxAllowedTime = mediaImageTime * ToleranceMultiplier;
81+
var maxAllowedTime = mediaImageTime * ToleranceMultiplier;
8282

8383
Assert.That(nativeDisplayTime, Is.LessThanOrEqualTo(maxAllowedTime),
8484
$"NativeBitmapDisplay ({nativeDisplayTime}ms) should be roughly as fast or faster than Media.Image ({mediaImageTime}ms). " +
0 Bytes
Loading
0 Bytes
Loading

CommonLibraryGui.Tests/WpfVectorRendererTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,8 @@ public void RenderToImage_VerifyDimensionsMatchBounds()
6969
// Assert
7070
// Circle radius 100 + thickness 10 = total diameter 210.
7171
// Our GetGraphicBounds should account for this.
72-
NUnit.Framework.Assert.That(image.Width, Is.GreaterThanOrEqualTo(200), "Image must be wide enough for the diameter.");
72+
NUnit.Framework.Assert.That(image.Width, Is.GreaterThanOrEqualTo(200),
73+
"Image must be wide enough for the diameter.");
7374
}
7475
}
7576
}

Communication.Tests/HttpWireTracingHandlerTests.cs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,12 @@ public async Task SendAsync_ShouldLogRequestAndResponseToTrace_AndReturnCorrectR
4040
var tracingHandler = new HttpWireTracingHandler
4141
{
4242
//switch Trace one and off
43-
LogToTrace = true,
44-
InnerHandler = innerHandler
43+
LogToTrace = true, InnerHandler = innerHandler
4544
};
4645

4746
using var client = new HttpClient(tracingHandler);
48-
var requestContent = new StringContent("{\"input\":\"data_from_riesa\"}", Encoding.UTF8, "application/json");
47+
var requestContent =
48+
new StringContent("{\"input\":\"data_from_riesa\"}", Encoding.UTF8, "application/json");
4949

5050
try
5151
{
@@ -66,13 +66,17 @@ public async Task SendAsync_ShouldLogRequestAndResponseToTrace_AndReturnCorrectR
6666
Assert.IsTrue(traceOutput.Contains("WIRE TRACE END"), "Trace missing end boundary.");
6767

6868
// Assert 3: Validierung der Request-Daten (>)
69-
Assert.IsTrue(traceOutput.Contains("> POST /test/api/endpoint"), "Request method or path path not traced correctly.");
69+
Assert.IsTrue(traceOutput.Contains("> POST /test/api/endpoint"),
70+
"Request method or path path not traced correctly.");
7071
Assert.IsTrue(traceOutput.Contains("> Host: localhost"), "Request host header missing in trace.");
71-
Assert.IsTrue(traceOutput.Contains("Content-Type: application/json"), "Content-Type header missing in request trace.");
72-
Assert.IsTrue(traceOutput.Contains("{\"input\":\"data_from_riesa\"}"), "Request body payload missing in trace.");
72+
Assert.IsTrue(traceOutput.Contains("Content-Type: application/json"),
73+
"Content-Type header missing in request trace.");
74+
Assert.IsTrue(traceOutput.Contains("{\"input\":\"data_from_riesa\"}"),
75+
"Request body payload missing in trace.");
7376

7477
// Assert 4: Validierung der Response-Daten (<)
75-
Assert.IsTrue(traceOutput.Contains("< HTTP/1.1 200 OK"), "Response status code line missing or incorrect in trace.");
78+
Assert.IsTrue(traceOutput.Contains("< HTTP/1.1 200 OK"),
79+
"Response status code line missing or incorrect in trace.");
7680
Assert.IsTrue(traceOutput.Contains(expectedResponseBody), "Response body payload missing in trace.");
7781
}
7882
finally
@@ -97,7 +101,8 @@ public MockHttpMessageHandler(HttpStatusCode statusCode, string content)
97101
_content = content;
98102
}
99103

100-
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request, CancellationToken cancellationToken)
104+
protected override Task<HttpResponseMessage> SendAsync(HttpRequestMessage request,
105+
CancellationToken cancellationToken)
101106
{
102107
var response = new HttpResponseMessage(_statusCode)
103108
{

0 commit comments

Comments
 (0)