-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from Blazam-App/Beta-Nightly
v0.8.2 Update
- Loading branch information
Showing
790 changed files
with
186,914 additions
and
18,393 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,123 @@ | ||
using BLAZAM.FileSystem; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Security.AccessControl; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace BLAZAM.Tests.FileSystem | ||
{ | ||
public class FileSystemBaseTests | ||
{ | ||
[Fact] | ||
public void Constructor_ThrowsArgumentException_WhenPathIsNull() | ||
{ | ||
// Arrange | ||
string path = null; | ||
|
||
// Act and Assert | ||
Assert.Throws<ArgumentException>(() => new FileSystemBase(path)); | ||
} | ||
|
||
[Fact] | ||
public void Constructor_ReplacesTempVariable_WhenPathContainsTemp() | ||
{ | ||
// Arrange | ||
string path = "%temp%\\test.txt"; | ||
|
||
// Act | ||
var fileSystemBase = new FileSystemBase(path); | ||
|
||
// Assert | ||
Assert.Equal(Path.GetTempPath() + "test.txt", fileSystemBase.Path); | ||
} | ||
|
||
[Fact] | ||
public void Constructor_SetsFullPath_WhenPathIsRelative() | ||
{ | ||
// Arrange | ||
string path = "..\\test.txt"; | ||
|
||
// Act | ||
var fileSystemBase = new FileSystemBase(path); | ||
|
||
// Assert | ||
Assert.Equal(Path.GetFullPath(path), fileSystemBase.Path); | ||
} | ||
|
||
[Fact] | ||
public void Writable_ReturnsTrue_WhenFileHasWritePermission() | ||
{ | ||
// Arrange | ||
string path = Path.GetTempFileName(); | ||
var fileSystemBase = new FileSystemBase(path); | ||
|
||
// Act | ||
bool writable = fileSystemBase.Writable; | ||
|
||
// Assert | ||
Assert.True(writable); | ||
|
||
// Clean up | ||
File.Delete(path); | ||
} | ||
//TODO Fix checking when no write permission | ||
//[Fact] | ||
//public void Writable_ReturnsFalse_WhenFileHasNoWritePermission() | ||
//{ | ||
// // Arrange | ||
// string path = Path.GetTempFileName(); | ||
// var fileSystemBase = new FileSystemBase(path); | ||
|
||
// // Deny write permission to the file | ||
// var ac = new FileInfo(path).GetAccessControl(); | ||
// ac.AddAccessRule(new FileSystemAccessRule(Environment.UserName, FileSystemRights.Write, AccessControlType.Deny)); | ||
// new FileInfo(path).SetAccessControl(ac); | ||
|
||
// // Act | ||
// bool writable = fileSystemBase.Writable; | ||
|
||
// // Assert | ||
// Assert.False(writable); | ||
|
||
// // Clean up | ||
// File.Delete(path); | ||
//} | ||
|
||
[Fact] | ||
public void GetHashCode_ReturnsPathHashCode() | ||
{ | ||
// Arrange | ||
string path = Path.GetTempFileName(); | ||
var fileSystemBase = new FileSystemBase(path); | ||
|
||
// Act | ||
int hashCode = fileSystemBase.GetHashCode(); | ||
|
||
// Assert | ||
Assert.Equal(path.GetHashCode(), hashCode); | ||
|
||
// Clean up | ||
File.Delete(path); | ||
} | ||
|
||
[Fact] | ||
public void ToString_ReturnsPath() | ||
{ | ||
// Arrange | ||
string path = Path.GetTempFileName(); | ||
var fileSystemBase = new FileSystemBase(path); | ||
|
||
// Act | ||
string toString = fileSystemBase.ToString(); | ||
|
||
// Assert | ||
Assert.Equal(path, toString); | ||
|
||
// Clean up | ||
File.Delete(path); | ||
} | ||
} | ||
|
||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.