コード例 #1
0
ファイル: DKIM.cs プロジェクト: radtek/hMailServer
        public void TestDKIMSpecificMessage()
        {
            hMailServer.AntiSpam antiSpam = _application.Settings.AntiSpam;

            string folderGood = Path.GetFullPath("../../../TestData/DKIM/Good");
            string path       = Path.Combine(Environment.CurrentDirectory, folderGood);

            string file = Path.Combine(path, "a.txt");

            DeleteCurrentLog();
            hMailServer.eDKIMResult result = antiSpam.DKIMVerify(file);
            Assert.AreEqual(hMailServer.eDKIMResult.eDKPass, result, file);
            Assert.IsTrue(VerifyLoadSuccess());
        }
コード例 #2
0
ファイル: DKIM.cs プロジェクト: shaqman/hmailserver
        public void TestDKIMMissingBH()
        {
            hMailServer.AntiSpam antiSpam = _application.Settings.AntiSpam;

            string folderMissingBH = Path.GetFullPath("../../../TestData/DKIM/Neutral - Missing bodyhash");
            string path            = Path.Combine(Environment.CurrentDirectory, folderMissingBH);

            string[] files = Directory.GetFiles(path);

            foreach (string file in files)
            {
                hMailServer.eDKIMResult result = antiSpam.DKIMVerify(file);
                Assert.AreEqual(hMailServer.eDKIMResult.eDKNeutral, result, file);
            }
        }
コード例 #3
0
ファイル: DKIM.cs プロジェクト: shaqman/hmailserver
        public void TestDKIMBadSignature()
        {
            hMailServer.AntiSpam antiSpam = _application.Settings.AntiSpam;

            string folder = Path.GetFullPath("../../../TestData/DKIM/PermFail");
            string path   = Path.Combine(Environment.CurrentDirectory, folder);

            string[] files = Directory.GetFiles(path);

            foreach (string file in files)
            {
                DeleteCurrentLog();
                hMailServer.eDKIMResult result = antiSpam.DKIMVerify(file);
                Assert.AreEqual(hMailServer.eDKIMResult.eDKPermFail, result, file);
                Assert.IsFalse(VerifyLoadSuccess());
            }
        }
コード例 #4
0
ファイル: DKIM.cs プロジェクト: shaqman/hmailserver
        public void TestDKIMMassTest()
        {
            int verificationCount = 5000;

            hMailServer.AntiSpam antiSpam = _application.Settings.AntiSpam;

            string folderGood = Path.GetFullPath("../../../TestData/DKIM/Good");
            string goodFile   = Directory.GetFiles(folderGood)[0];

            for (int i = 0; i < verificationCount; i++)
            {
                DeleteCurrentLog();
                hMailServer.eDKIMResult result = antiSpam.DKIMVerify(goodFile);
                Assert.AreEqual(hMailServer.eDKIMResult.eDKPass, result, goodFile);
                Assert.IsTrue(VerifyLoadSuccess());
            }
        }
コード例 #5
0
ファイル: DKIM.cs プロジェクト: x3650/hmailserver
        public void TestDKIMUnsupported()
        {
            hMailServer.AntiSpam antiSpam = _application.Settings.AntiSpam;

            string folder = Path.GetFullPath("../../../TestData/DKIM/Unsupported");
            string path   = Path.Combine(TestContext.CurrentContext.TestDirectory, folder);

            string[] files = Directory.GetFiles(path);

            foreach (string file in files)
            {
                DeleteCurrentLog();
                hMailServer.eDKIMResult result = antiSpam.DKIMVerify(file);
                Assert.AreEqual(hMailServer.eDKIMResult.eDKNeutral, result, file);
                Assert.IsFalse(VerifyLoadSuccess());
            }
        }
コード例 #6
0
ファイル: DKIM.cs プロジェクト: nunodotferreira/hmailserver
        public void TestDKIMGood()
        {
            hMailServer.AntiSpam antiSpam = _application.Settings.AntiSpam;

            string folderGood = Path.GetFullPath("../../../TestData/DKIM/Good");
            string path       = Path.Combine(TestContext.CurrentContext.TestDirectory, folderGood);

            string[] files = Directory.GetFiles(folderGood);

            foreach (string file in files)
            {
                DeleteCurrentLog();
                Console.WriteLine(string.Format("Testing file {0}...", file));
                hMailServer.eDKIMResult result = antiSpam.DKIMVerify(file);
                Assert.AreEqual(hMailServer.eDKIMResult.eDKPass, result, file);
                Assert.IsTrue(VerifyLoadSuccess());
            }
        }