Skip to content

Commit

Permalink
Fix new Visual Studio warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
RehanSaeed committed Aug 24, 2022
1 parent 84382ee commit 3e7788f
Show file tree
Hide file tree
Showing 9 changed files with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,7 @@ public virtual void ToString(StringBuilder stringBuilder)
stringBuilder.AppendMetaPropertyContent("og:type", this.Type.ToLowercaseString());
}

if (this.Url is null)
{
this.Url = this.GetRequestUrl();
}
this.Url ??= this.GetRequestUrl();

stringBuilder.AppendMetaPropertyContent("og:url", this.Url);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Boxed.AspNetCore.Middleware;
/// The <see cref="HttpException"/> handling middleware.
/// </summary>
/// <seealso cref="IMiddleware" />
internal class HttpExceptionMiddleware : IMiddleware
public class HttpExceptionMiddleware : IMiddleware
{
private readonly RequestDelegate next;
private readonly HttpExceptionMiddlewareOptions options;
Expand Down
2 changes: 1 addition & 1 deletion Source/Boxed.DotnetNewTest/AsyncDisposableAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Boxed.DotnetNewTest;
/// Executes an asynchronous operation when disposed.
/// </summary>
/// <seealso cref="IAsyncDisposable" />
internal class AsyncDisposableAction : IAsyncDisposable
internal sealed class AsyncDisposableAction : IAsyncDisposable
{
private readonly Func<ValueTask> action;

Expand Down
2 changes: 1 addition & 1 deletion Source/Boxed.DotnetNewTest/ConsoleColorScope.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ namespace Boxed.DotnetNewTest;
/// Sets the console foreground and/or background colour for the specified scope.
/// </summary>
/// <seealso cref="IDisposable" />
internal class ConsoleColorScope : IDisposable
internal sealed class ConsoleColorScope : IDisposable
{
private readonly ConsoleColor backgroundColor;
private readonly ConsoleColor foregroundColor;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public void Apply_TypeIsModelStateDictionary_DoesNothing()
}

#pragma warning disable CA1812 // Never instantiated
internal class Model
internal sealed class Model
#pragma warning restore CA1812 // Never instantiated
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ public async Task ProcessAsync_Sha256And384And512SriNotCached_CachesSriAndReturn
Assert.Equal(expectedSri, htmlString.Value);
}

internal class TestSubresourceIntegrityTagHelper : SubresourceIntegrityTagHelper
internal sealed class TestSubresourceIntegrityTagHelper : SubresourceIntegrityTagHelper
{
public TestSubresourceIntegrityTagHelper(
IDistributedCache distributedCache,
Expand Down
2 changes: 1 addition & 1 deletion Tests/Boxed.AspNetCore.Test/CursorTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public void ToCursor_NullableDateOnlyValue_ReturnsPrefixedBase64Cursor()
Assert.Equal("MjAwMC0wMS0wMQ==", cursor);
}

private class Item
private sealed class Item
{
public int Integer { get; set; }
}
Expand Down
6 changes: 3 additions & 3 deletions Tests/Boxed.AspNetCore.Test/DistributedCacheExtensionsTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public async Task GetAsJsonAsync_ValidValue_ReturnsDeserializedObjectAsync()
{
this.distributedCacheMock
.Setup(x => x.GetAsync("Key", cancellationTokenSource.Token))
.ReturnsAsync(Encoding.UTF8.GetBytes("{\"Value\":1}"));
.ReturnsAsync(Encoding.UTF8.GetBytes(/*lang=json,strict*/ "{\"Value\":1}"));

var testClass = await this.distributedCacheMock.Object
.GetAsJsonAsync<TestClass>("Key", null, cancellationTokenSource.Token)
Expand Down Expand Up @@ -61,7 +61,7 @@ public async Task SetAsJsonAsync_ValidValue_SavesSerializedValueAsync()
this.distributedCacheMock
.Setup(x => x.SetAsync(
"Key",
It.Is<byte[]>(y => y.SequenceEqual(Encoding.UTF8.GetBytes("{\"Value\":1}"))),
It.Is<byte[]>(y => y.SequenceEqual(Encoding.UTF8.GetBytes(/*lang=json,strict*/ "{\"Value\":1}"))),
null,
cancellationTokenSource.Token))
.Returns(Task.CompletedTask);
Expand All @@ -74,7 +74,7 @@ await this.distributedCacheMock.Object

public void Dispose() => Mock.VerifyAll(this.distributedCacheMock);

internal class TestClass
internal sealed class TestClass
{
public int Value { get; set; }
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public async Task InvokeAsync_SupportsTrailingHeaders_AddsServerTimingHttpHeader
Assert.Equal("app;dur=0.0", header.Value.ToString());
}

internal class ResponseTrailersFeature : IHttpResponseTrailersFeature
internal sealed class ResponseTrailersFeature : IHttpResponseTrailersFeature
{
public IHeaderDictionary Trailers { get; set; } = new HeaderDictionary();
}
Expand Down

0 comments on commit 3e7788f

Please sign in to comment.