Skip to content

Commit

Permalink
Removed the static declarations from the FileVersionInfo factories.
Browse files Browse the repository at this point in the history
  • Loading branch information
Kormos Tamás committed Dec 17, 2024
1 parent 7cfdca7 commit dd68ff2
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 31 deletions.
Original file line number Diff line number Diff line change
@@ -1,35 +1,24 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System.IO.Abstractions.TestingHelpers
namespace System.IO.Abstractions.TestingHelpers
{
/// <inheritdoc />
#if FEATURE_SERIALIZABLE
[Serializable]
#endif
public class MockFileVersionInfoFactory : IFileVersionInfoFactory
{
private static IMockFileDataAccessor mockFileSystem;
private readonly IMockFileDataAccessor mockFileSystem;

/// <inheritdoc />
public MockFileVersionInfoFactory(IMockFileDataAccessor mockFileSystem)
{
MockFileVersionInfoFactory.mockFileSystem = mockFileSystem ?? throw new ArgumentNullException(nameof(mockFileSystem));
this.mockFileSystem = mockFileSystem ?? throw new ArgumentNullException(nameof(mockFileSystem));
}

/// <inheritdoc />
public IFileSystem FileSystem => mockFileSystem;

IFileVersionInfo IFileVersionInfoFactory.GetVersionInfo(string fileName)
{
return GetVersionInfo(fileName);
}

/// <inheritdoc cref="Diagnostics.FileVersionInfo.GetVersionInfo(string)" />
public static IFileVersionInfo GetVersionInfo(string fileName)
/// <inheritdoc />
public IFileVersionInfo GetVersionInfo(string fileName)
{
MockFileData mockFileData = mockFileSystem.GetFile(fileName);

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace System.IO.Abstractions
namespace System.IO.Abstractions
{
#if FEATURE_SERIALIZABLE
[Serializable]
Expand All @@ -22,16 +16,11 @@ public FileVersionInfoFactory(IFileSystem fileSystem)
/// <inheritdoc />
public IFileSystem FileSystem => fileSystem;

IFileVersionInfo IFileVersionInfoFactory.GetVersionInfo(string fileName)
{
return GetVersionInfo(fileName);
}

/// <inheritdoc cref="Diagnostics.FileVersionInfo.GetVersionInfo(string)" />
public static IFileVersionInfo GetVersionInfo(string fileName)
/// <inheritdoc />
public IFileVersionInfo GetVersionInfo(string fileName)
{
Diagnostics.FileVersionInfo fileVersionInfo = Diagnostics.FileVersionInfo.GetVersionInfo(fileName);

return new FileVersionInfoWrapper(fileVersionInfo);
}
}
Expand Down

0 comments on commit dd68ff2

Please sign in to comment.