You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Zero/Tests/ZeroLevel.UnitTests/FSUtilsTest.cs

34 lines
1.2 KiB

using System.Collections.Generic;
using Xunit;
using ZeroLevel.Services.FileSystem;
namespace ZeroLevel.UnitTests
{
public class FSUtilsTest
{
[Fact]
public void FileNameCorrectionTest()
{
// Arrange
var validNames = new List<string> { "CON1", "a.cOn.a", "$PRN", "LPT10", "lpt10.txt", "COM11.ee" };
var invalidNames = new List<string> { "CON", "cOn", "PRN", "LPT4", "LPT4.", "LPT4.txt", "COM1.ee" };
var invalidRootNames = new List<string> { "$mft", "$mftmirr", "$logfile", "$volume", "$attrdef", "$bitmap", "$boot", "$badclus", "$secure", "$upcase", "$extend", "$quota", "$objid", "$reparse" };
// Act
// Assert
foreach (var validName in validNames)
{
Assert.Equal(validName, FSUtils.FileNameCorrection(validName));
}
foreach (var invalidName in invalidNames)
{
Assert.NotEqual(invalidName, FSUtils.FileNameCorrection(invalidName));
}
foreach (var invalidName in invalidRootNames)
{
Assert.NotEqual(invalidName, FSUtils.FileNameCorrection(invalidName, true));
}
}
}
}

Powered by TurnKey Linux.