Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -518,7 +518,9 @@ public void Directory_exists_after_creation_with_security()
var directoryInfo = fileSystem.DirectoryInfo.New(XFS.Path(@"c:\abc"));

// Act
#pragma warning disable CA1416
directoryInfo.Create(new DirectorySecurity());
#pragma warning restore CA1416

// Assert
Assert.That(directoryInfo.Exists, Is.True);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2085,7 +2085,9 @@ public void MockDirectory_GetAccessControl_ShouldThrowExceptionOnDirectoryNotFou
var fileSystem = new MockFileSystem();

// Act
#pragma warning disable CA1416
Assert.Throws<DirectoryNotFoundException>(() => fileSystem.Directory.GetAccessControl(XFS.Path(@"c:\foo")));
#pragma warning restore CA1416
}

[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ private static IEnumerable<Action<IFile>> GetFileSystemActionsForArgumentNullExc
yield return fs => fs.SetLastAccessTimeUtc((string)null, DateTime.Now);
yield return fs => fs.SetLastWriteTime((string)null, DateTime.Now);
yield return fs => fs.SetLastWriteTimeUtc((string)null, DateTime.Now);
#pragma warning disable CA1416
yield return fs => fs.Decrypt(null);
yield return fs => fs.Encrypt(null);
#pragma warning restore CA1416
}

[TestCaseSource(nameof(GetFileSystemActionsForArgumentNullException))]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,10 @@ public void MockFileInfo_OpenRead_ShouldReturnByteContentOfFile()
byte[] result = new byte[2];
using (var stream = fileInfo.OpenRead())
{
#pragma warning disable CA2022
// ReSharper disable once MustUseReturnValue
stream.Read(result, 0, 2);
#pragma warning restore CA2022
}

Assert.That(result, Is.EqualTo(new byte[] { 1, 2 }));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,9 @@ public void MockFile_Read_ShouldRetainCreationTimeAndUpdateLastAccessTime()
var fi = fs.FileInfo.New(filepath);
var stream = fi.OpenRead();
var buffer = new byte[16];
#pragma warning disable CA2022
stream.Read(buffer, 0, buffer.Length);
#pragma warning restore CA2022
fi.Refresh();
// Assert
Assert.That(fi.CreationTime, Is.EqualTo(creationTime));
Expand All @@ -270,7 +272,12 @@ public async Task MockFile_ReadAsync_ShouldRetainCreationTimeAndUpdateLastAccess
var fi = fs.FileInfo.New(filepath);
var stream = fi.OpenRead();
var buffer = new byte[16];
#pragma warning disable CA1835
#pragma warning disable CA2022
// ReSharper disable once MustUseReturnValue
await stream.ReadAsync(buffer, 0, buffer.Length);
#pragma warning restore CA2022
#pragma warning restore CA1835
fi.Refresh();
// Assert
Assert.That(fi.CreationTime, Is.EqualTo(creationTime));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -605,7 +605,9 @@ public void MockFile_Encrypt_ShouldSetEncryptedAttribute()
});

// Act
#pragma warning disable CA1416
fileSystem.File.Encrypt(filePath);
#pragma warning restore CA1416
var attributes = fileSystem.File.GetAttributes(filePath);

// Assert
Expand All @@ -623,10 +625,14 @@ public void MockFile_Decrypt_ShouldRemoveEncryptedAttribute()
{
{filePath, fileData }
});
#pragma warning disable CA1416
fileSystem.File.Encrypt(filePath);
#pragma warning restore CA1416

// Act
#pragma warning disable CA1416
fileSystem.File.Decrypt(filePath);
#pragma warning restore CA1416
var attributes = fileSystem.File.GetAttributes(filePath);

// Assert
Expand Down