Files
PulsarK-main/Pulsar.Common.Tests/Helpers/FileHelper.Tests.cs
T
i2p 773d05f8f1
Pulsar .NET 9.0 Windows Release / build (push) Waiting to run
Mirror to Codeberg and Gitea / mirror (push) Waiting to run
initial commit
2026-08-27 10:57:58 -06:00

36 lines
935 B
C#

using Microsoft.VisualStudio.TestTools.UnitTesting;
using Pulsar.Common.Helpers;
namespace Pulsar.Common.Tests.Helpers
{
[TestClass]
public class FileHelperTests
{
[TestMethod, TestCategory("Helpers")]
public void RandomFilenameTest()
{
int length = 100;
var name = FileHelper.GetRandomFilename(length);
Assert.IsNotNull(name);
Assert.IsTrue(name.Length == length);
}
[TestMethod, TestCategory("Helpers")]
public void ValidateExecutableTest()
{
var bytes = new byte[] { 77, 90 };
Assert.IsTrue(FileHelper.HasExecutableIdentifier(bytes));
}
[TestMethod, TestCategory("Helpers")]
public void ValidateExecutableTest2()
{
var bytes = new byte[] { 22, 93 };
Assert.IsFalse(FileHelper.HasExecutableIdentifier(bytes));
}
}
}