public void DetectsEICAR() { // ARRANGE var scan = new Scan(); using (var client = AMSIClient.Create()) using (var testItems = new TestItemsBag(client)) { testItems .ClientTest(c => scan.EICARString()) .ClientTest(c => scan.EICARByteArray()) .ClientTest(c => scan.String(EICARTestData.EICARText, nameof(EICARTestData.EICARText))) .ClientTest(c => scan.Buffer( EICARTestData.EICARZippedBytes , EICARTestData.EICARZippedBytes.Length , nameof(EICARTestData.EICARZippedBytes))) .ClientTest(c => scan.Buffer( EICARTestData.EICARZippedBytes , (uint)EICARTestData.EICARZippedBytes.Length , nameof(EICARTestData.EICARZippedBytes))) .ClientTest(c => scan.File(testItems.CreateTemporaryFile(EICARTestData.EICARZippedBytes))) .ClientTest(c => c.TestEICARString()) .ClientTest(c => c.TestEICARByteArray()) .ClientTest(c => c.ScanString(EICARTestData.EICARText, nameof(EICARTestData.EICARText))) .ClientTest(c => c.ScanBuffer( EICARTestData.EICARZippedBytes , EICARTestData.EICARZippedBytes.Length , nameof(EICARTestData.EICARZippedBytes))) .ClientTest(c => c.ScanFile(testItems.CreateTemporaryFile(EICARTestData.EICARZippedBytes))) .SessionTest(c => c.ScanString(EICARTestData.EICARText, nameof(EICARTestData.EICARText))) .SessionTest(c => c.ScanBuffer( EICARTestData.EICARZippedBytes , EICARTestData.EICARZippedBytes.Length , nameof(EICARTestData.EICARZippedBytes))) .SessionTest(c => c.ScanFile(testItems.CreateTemporaryFile(EICARTestData.EICARZippedBytes))); // ACT foreach (var result in testItems) { // ASSERT Assert.IsFalse(result.IsSafe); Assert.IsTrue( result.Result == DetectionResult.IdentifiedAsMalware || result.Result == DetectionResult.FileBlocked); Assert.IsTrue(HasValidData(result)); } } }