wabbajack/Wabbajack.Server.Test/VirusCheckTests.cs
Timothy Baldridge 13068a59e7 Code cleanup
2020-09-30 21:50:09 -06:00

38 lines
1.0 KiB
C#

using System.Threading.Tasks;
using Wabbajack.BuildServer.Test;
using Wabbajack.Common;
using Wabbajack.Lib;
using Xunit;
using Xunit.Abstractions;
namespace Wabbajack.Server.Test
{
public class VirusCheckTests : ABuildServerSystemTest
{
public VirusCheckTests(ITestOutputHelper output, SingletonAdaptor<BuildServerFixture> fixture) : base(output, fixture)
{
}
[Fact]
public async Task CheckVirus()
{
var tmpFile = new TempFile();
var meta = Game.SkyrimSpecialEdition.MetaData();
var srcFile = meta.GameLocation().Combine(meta.MainExecutable!);
await srcFile.CopyToAsync(tmpFile.Path);
using (var s = await tmpFile.Path.OpenWrite())
{
s.Position = 1000;
s.WriteByte(42);
}
Assert.True(await VirusScanner.ShouldScan(tmpFile.Path));
Assert.Equal(VirusScanner.Result.NotMalware, await ClientAPI.GetVirusScanResult(tmpFile.Path));
}
}
}