.NET 8 Upgrade Silenced Errors Fix (#30469)

* [Dev][Build] .NET 8 Upgrade Silenced errors first fix.

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1859

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1854.

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1860

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1861

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1862

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1863

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1864

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA1865

* [Dev][Build] .NET 8 Upgrade Silenced errors. CA2208

* [Dev][Build] .NET 8 Upgrade Silenced errors. CS9191

* [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check

* [Dev][Build] .NET 8 Upgrade Silenced errors. Spell check

* [Dev][Build] .NET 8 Upgrade Silenced errors.
- CompositeFormat variables used more than once in the same file were assigned to a single variable.
- GetProcessesByName logic fix.
- String comparion fix.
- ArgumentOutOfRangeException message change.

* [Dev][Build] .NET 8 Upgrade Silenced errors.
- Null check added.
- static readonly CompositeFormat added for all fields.
This commit is contained in:
gokcekantarci
2023-12-28 13:37:13 +03:00
committed by GitHub
parent cd57659ef6
commit a94b3eec39
112 changed files with 429 additions and 291 deletions

View File

@@ -16,7 +16,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
{
// Arrange
var itemName = "originalItem1";
IRepository<string> repository = new ListRepository<string>() { itemName };
ListRepository<string> repository = new ListRepository<string>() { itemName };
// Act
var result = repository.Contains(itemName);
@@ -29,7 +29,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
public void ContainsShouldReturnTrueWhenListIsUpdatedWithAdd()
{
// Arrange
IRepository<string> repository = new ListRepository<string>();
ListRepository<string> repository = new ListRepository<string>();
// Act
var itemName = "newItem";
@@ -45,7 +45,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
{
// Arrange
var itemName = "originalItem1";
IRepository<string> repository = new ListRepository<string>() { itemName };
ListRepository<string> repository = new ListRepository<string>() { itemName };
// Act
repository.Remove(itemName);

View File

@@ -25,6 +25,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
private List<IFileSystemWatcherWrapper> _fileSystemWatchers;
private List<Mock<IFileSystemWatcherWrapper>> _fileSystemMocks;
private static readonly string[] Path = new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" };
[TestInitialize]
public void SetFileSystemWatchers()
@@ -219,7 +220,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
// File.ReadAllLines must be mocked for url applications
var mockFile = new Mock<IFile>();
mockFile.Setup(m => m.ReadAllLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
mockFile.Setup(m => m.ReadAllLines(It.IsAny<string>())).Returns(Path);
Win32Program.FileWrapper = mockFile.Object;
// Act
@@ -268,7 +269,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
// File.ReadAllLines must be mocked for url applications
var mockFile = new Mock<IFile>();
mockFile.Setup(m => m.ReadLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
mockFile.Setup(m => m.ReadLines(It.IsAny<string>())).Returns(Path);
Win32Program.FileWrapper = mockFile.Object;
string fullPath = directory + "\\" + path;
@@ -292,7 +293,7 @@ namespace Microsoft.Plugin.Program.UnitTests.Storage
// File.ReadAllLines must be mocked for url applications
var mockFile = new Mock<IFile>();
mockFile.Setup(m => m.ReadLines(It.IsAny<string>())).Returns(new string[] { "URL=steam://rungameid/1258080", "IconFile=iconFile" });
mockFile.Setup(m => m.ReadLines(It.IsAny<string>())).Returns(Path);
Win32Program.FileWrapper = mockFile.Object;
string oldFullPath = directory + "\\" + oldpath;