mirror of
https://github.com/quasar/Quasar.git
synced 2026-10-26 02:19:49 +08:00
- improved unit tests with categories - removed validating of batch files, we can not really validate them
38 lines
1.1 KiB
C#
38 lines
1.1 KiB
C#
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
|
using xClient.Core.Helper;
|
|
|
|
namespace xClient.Tests.Core.Helper
|
|
{
|
|
[TestClass]
|
|
public class FileHelperTests
|
|
{
|
|
[TestMethod, TestCategory("Helper")]
|
|
public void RandomFilenameTest()
|
|
{
|
|
int length = 100;
|
|
var name = FileHelper.GetRandomFilename(length);
|
|
Assert.IsNotNull(name);
|
|
Assert.IsTrue(name.Length == length, "Filename has wrong length!");
|
|
}
|
|
|
|
[TestMethod, TestCategory("Helper")]
|
|
public void ValidateExecutableTest()
|
|
{
|
|
var bytes = new byte[] {77, 90};
|
|
|
|
var result = FileHelper.IsValidExecuteableFile(bytes);
|
|
|
|
Assert.IsTrue(result, "Validating a .exe file failed!");
|
|
}
|
|
|
|
[TestMethod, TestCategory("Helper")]
|
|
public void ValidateInvalidFileTest()
|
|
{
|
|
var bytes = new byte[] {22, 93};
|
|
|
|
var result = FileHelper.IsValidExecuteableFile(bytes);
|
|
|
|
Assert.IsFalse(result, "Validating an invalid file worked!");
|
|
}
|
|
}
|
|
} |