wabbajack/Wabbajack.Server.Test/VirusCheckTests.cs

38 lines
1.0 KiB
C#
Raw Normal View History

2020-10-01 03:50:09 +00:00
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));
}
}
}