Skip to content

Commit fddc74e

Browse files
committed
[fix] analyzer warnings
[r] naming
1 parent 64c7244 commit fddc74e

37 files changed

Lines changed: 144 additions & 109 deletions

File tree

src/SampleApps/SampleApp.Angular/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,4 +41,4 @@
4141
if (!app.Environment.IsDevelopment())
4242
app.UseSpa(spa => spa.Options.SourcePath = "ClientApp");
4343

44-
app.Run();
44+
await app.RunAsync();

src/SampleApps/SampleApp.Api/Startup.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55

66
var builder = WebApplication.CreateBuilder(args);
77

8-
(DIContainer.Current = new SimpleInjectorDIProvider())
8+
DIContainer.Current = new SimpleInjectorDIProvider();
9+
10+
DIContainer.Current
911
.RegisterAll(builder.Services)
1012
.Verify();
1113

1214
var app = builder.Build();
1315

1416
app.UseSimplifyWeb();
1517

16-
app.Run();
18+
await app.RunAsync();

src/SampleApps/SampleApp.Classic/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030

3131
BootstrapperFactory.ContainerProvider.Verify();
3232

33-
app.Run();
33+
await app.RunAsync();

src/Simplify.Web.Benchmark/ExpandoObjectAndDictionaryBenchmarks.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
using System.Diagnostics;
21
using System.Dynamic;
32
using BenchmarkDotNet.Attributes;
43

4+
#pragma warning disable S1104
5+
56
namespace Simplify.Web.Benchmark;
67

78
[MemoryDiagnoser]
@@ -73,27 +74,27 @@ private static ExpandoObject ToExpando(Dictionary<string, object> dictionary)
7374

7475
private void TestDynamic(dynamic list)
7576
{
76-
for (int i = 0; i < NumValues; i++)
77+
for (var i = 0; i < NumValues; i++)
7778
{
78-
string value = list.Key0;
79-
Trace.WriteLine(value);
79+
var value = list.Key0;
80+
Console.WriteLine(value);
8081
}
8182
}
8283

8384
private void TestDictionary(IDictionary<string, object> list)
8485
{
85-
for (int i = 0; i < NumValues; i++)
86+
for (var i = 0; i < NumValues; i++)
8687
{
87-
string value = list[$"Key{i}"].ToString();
88-
Trace.WriteLine(value);
88+
var value = list[$"Key{i}"].ToString();
89+
Console.WriteLine(value);
8990
}
9091
}
9192

9293
private IDictionary<string, object> CreateAndFillExpando()
9394
{
9495
var expandoDict = (IDictionary<string, object>)new ExpandoObject();
9596

96-
for (int i = 0; i < NumValues; i++)
97+
for (var i = 0; i < NumValues; i++)
9798
expandoDict[$"Key{i}"] = $"Value{i}";
9899

99100
return expandoDict;
@@ -103,7 +104,7 @@ private Dictionary<string, object> CreateAndFillDictionary()
103104
{
104105
var dictionary = new Dictionary<string, object>();
105106

106-
for (int i = 0; i < NumValues; i++)
107+
for (var i = 0; i < NumValues; i++)
107108
dictionary[$"Key{i}"] = $"Value{i}";
108109

109110
return dictionary;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Simplify.Web.Bootstrapper.Setup;
22

3+
#pragma warning disable S2094
4+
35
namespace Simplify.Web.Meta.Tests.TestTypes.Bootstrapper;
46

5-
public class TestBootstrapper : BaseBootstrapper
6-
{
7-
}
7+
public class TestBootstrapper : BaseBootstrapper;

src/Simplify.Web.Tests/Benchmark/ExpandoVsDictionaryBenchmark.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ public void ExpandoObjectTest(int numValues)
4444
Console.WriteLine($"Dynamic Read Time: {dynamicReadStopwatch.ElapsedMilliseconds} ms");
4545
Console.WriteLine($"IDictionary<string, object> Read Time: {dictionaryReadStopwatch.ElapsedMilliseconds} ms");
4646
Console.WriteLine($"Overall Performance Time: {overallStopwatch.ElapsedMilliseconds} ms");
47+
48+
Assert.Pass();
4749
}
4850

4951
[TestCase(1)]
@@ -78,6 +80,8 @@ public void DictionaryTest(int numValues)
7880
Console.WriteLine($"Dynamic Read Time: {dynamicReadStopwatch.ElapsedMilliseconds} ms");
7981
Console.WriteLine($"IDictionary<string, object> Read Time: {dictionaryReadStopwatch.ElapsedMilliseconds} ms");
8082
Console.WriteLine($"Overall Performance Time: {overallStopwatch.ElapsedMilliseconds} ms");
83+
84+
Assert.Pass();
8185
}
8286

8387
private static ExpandoObject ToExpando(IDictionary<string, object> dictionary)
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using Simplify.Web.Bootstrapper.Setup;
22

3+
#pragma warning disable S2094
4+
35
namespace Simplify.Web.Tests.Bootstrapper.TestTypes;
46

5-
public class TestBootstrapper : BaseBootstrapper
6-
{
7-
}
7+
public class TestBootstrapper : BaseBootstrapper;

src/Simplify.Web.Tests/Controllers/Resolution/Stages/RouteMatchingStageTests.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ public void Execute_MatchedMethodButNotMatchedRoute_ExecutionStoppedAndIsMatched
7575
_routeMatcherResolver.Setup(x => x.Resolve(It.IsAny<IControllerMetadata>())).Returns(routeMatcher.Object);
7676

7777
routeMatcher.Setup(x => x.Match(It.IsAny<IList<string>>(), It.Is<IControllerRoute>(r => r == controllerRoute)))
78-
.Returns(Mock.Of<IRouteMatchResult>(x =>
79-
x.Success == false));
78+
.Returns(Mock.Of<IRouteMatchResult>(x => !x.Success));
8079

8180
// Act
8281
_stage.Execute(state, context, stopExecution.Object);
@@ -122,7 +121,7 @@ public void Execute_MatchedMethodAndMatchedRoute_IsMatchedAndRouteParametersAreS
122121

123122
routeMatcher.Setup(x => x.Match(It.IsAny<IList<string>>(), It.Is<IControllerRoute>(s => s == controllerRoute)))
124123
.Returns(Mock.Of<IRouteMatchResult>(x =>
125-
x.Success == true &&
124+
x.Success &&
126125
x.RouteParameters == new Dictionary<string, object>()));
127126

128127
// Act

src/Simplify.Web.Tests/Controllers/V2/Metadata/MetadataTests/TestTypes/VoidResultController.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,7 @@ namespace Simplify.Web.Tests.Controllers.V2.Metadata.MetadataTests.TestTypes;
33
public class VoidResultController : Controller2
44
{
55
public void Invoke()
6-
{ }
6+
{
7+
// Test controller with void return type
8+
}
79
}

src/Simplify.Web.Tests/Http/Cache/RequestCacheExtensionsTests.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ public void IsFileCanBeUsedFromCache_FileLastModifiedTimeLessThanIfModifiedSince
1414
{
1515
// Arrange
1616

17-
var lastModificationTime = new DateTime(2015, 10, 21, 07, 27, 0);
17+
var lastModificationTime = new DateTime(2015, 10, 21, 07, 27, 0, DateTimeKind.Utc);
1818

1919
var request = Mock.Of<HttpRequest>(r => r.Headers == new HeaderDictionary
2020
{
@@ -33,7 +33,7 @@ public void IsFileCanBeUsedFromCache_FileLastModifiedTimeEqualsIfModifiedSinceTi
3333
{
3434
// Arrange
3535

36-
var lastModificationTime = new DateTime(2015, 10, 21, 07, 28, 0);
36+
var lastModificationTime = new DateTime(2015, 10, 21, 07, 28, 0, DateTimeKind.Utc);
3737

3838
var request = Mock.Of<HttpRequest>(r => r.Headers == new HeaderDictionary
3939
{
@@ -52,7 +52,7 @@ public void IsFileCanBeUsedFromCache_FileLastModifiedTimeGreaterThanIfModifiedSi
5252
{
5353
// Arrange
5454

55-
var lastModificationTime = new DateTime(2015, 10, 21, 07, 28, 1);
55+
var lastModificationTime = new DateTime(2015, 10, 21, 07, 28, 1, DateTimeKind.Utc);
5656

5757
var request = Mock.Of<HttpRequest>(r => r.Headers == new HeaderDictionary
5858
{
@@ -71,11 +71,9 @@ public void IsFileCanBeUsedFromCache_IfModifiedSinceTimeIsNotPresent_False()
7171
{
7272
// Arrange
7373

74-
var lastModificationTime = new DateTime(2015, 10, 21, 07, 28, 1);
74+
var lastModificationTime = new DateTime(2015, 10, 21, 07, 28, 1, DateTimeKind.Utc);
7575

76-
var request = Mock.Of<HttpRequest>(r => r.Headers == new HeaderDictionary
77-
{
78-
});
76+
var request = Mock.Of<HttpRequest>(r => r.Headers == new HeaderDictionary());
7977

8078
// Act
8179
var result = request.IsFileCanBeUsedFromCache(lastModificationTime);
@@ -89,7 +87,7 @@ public void IsFileCanBeUsedFromCache_NoCacheRequestedHeaderPresentButValidToCach
8987
{
9088
// Arrange
9189

92-
var lastModificationTime = new DateTime(2015, 10, 21, 07, 28, 0);
90+
var lastModificationTime = new DateTime(2015, 10, 21, 07, 28, 0, DateTimeKind.Utc);
9391

9492
var request = Mock.Of<HttpRequest>(r => r.Headers == new HeaderDictionary
9593
{

0 commit comments

Comments
 (0)