1
0

Adding support for .NET 8.0 LTS, renaming private fields to start with underscore

This commit is contained in:
2023-12-29 01:58:40 +01:00
parent 8bd511a936
commit 99d3f7758a
59 changed files with 922 additions and 871 deletions

View File

@@ -7,11 +7,11 @@ namespace UnitTests.Common.Utils
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal class CryptographyHelperSaltMock : IDisposable
{
private readonly int saltLength;
private readonly int _saltLength;
private CryptographyHelperSaltMock(int saltLength)
{
this.saltLength = typeof(CryptographyHelper).AsDynamicType().saltLength;
_saltLength = typeof(CryptographyHelper).AsDynamicType()._saltLength;
SetSaltLength(saltLength);
}
@@ -19,9 +19,9 @@ namespace UnitTests.Common.Utils
=> new CryptographyHelperSaltMock(saltLength);
public void Dispose()
=> SetSaltLength(saltLength);
=> SetSaltLength(_saltLength);
private static void SetSaltLength(int length)
=> typeof(CryptographyHelper).AsDynamicType().saltLength = length;
=> typeof(CryptographyHelper).AsDynamicType()._saltLength = length;
}
}

View File

@@ -4,13 +4,8 @@ namespace UnitTests.Common.Utils
{
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
[AttributeUsage(AttributeTargets.All, AllowMultiple = true)]
internal class CustomMultipleAttribute : Attribute
internal class CustomMultipleAttribute(string name) : Attribute
{
public CustomMultipleAttribute(string name)
{
Name = name;
}
public string Name { get; set; }
public string Name { get; set; } = name;
}
}

View File

@@ -33,18 +33,21 @@ namespace UnitTests.Common.Utils
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal class JsonErrorClass
{
private int? number;
private int? _number;
public int Number
{
get
{
if (number.HasValue)
return number.Value;
if (_number.HasValue)
return _number.Value;
throw new Exception("Null value");
}
set { number = value; }
set
{
_number = value;
}
}
}
}

View File

@@ -6,11 +6,11 @@ namespace UnitTests.Common.Utils
[System.Diagnostics.CodeAnalysis.ExcludeFromCodeCoverage]
internal class TimeZoneInfoLocalMock : IDisposable
{
private readonly TimeZoneInfo localTimeZoneInfo;
private readonly TimeZoneInfo _localTimeZoneInfo;
private TimeZoneInfoLocalMock(TimeZoneInfo timeZoneInfo)
{
localTimeZoneInfo = TimeZoneInfo.Local;
_localTimeZoneInfo = TimeZoneInfo.Local;
SetLocalTimeZone(timeZoneInfo);
}
@@ -18,7 +18,7 @@ namespace UnitTests.Common.Utils
=> new TimeZoneInfoLocalMock(mockTimeZoneInfo);
public void Dispose()
=> SetLocalTimeZone(localTimeZoneInfo);
=> SetLocalTimeZone(_localTimeZoneInfo);
private static void SetLocalTimeZone(TimeZoneInfo timeZoneInfo)
=> typeof(TimeZoneInfo).AsDynamicType().s_cachedData._localTimeZone = timeZoneInfo;