コード例 #1
0
        public void LoadFirewallRulesTest()
        {
            TestUtility.TestProlog();

            string traceLogPath = Utility.GenerateProgramFilePath(Program.Config.WorkingDirectoryPath, ".log");

            using (TraceLogger traceLogger = new TraceLogger(traceLogPath))
            {
                FirewallInfoCollectorTest collector = new FirewallInfoCollectorTest(traceLogger);

                // long as no exception is thrown
                IEnumerable <INetFwRule> rules = collector.LoadFirewallRules();
                Assert.IsNotNull(rules);
            }

            File.Delete(traceLogPath);
            TestUtility.TestEpilog();
        }
コード例 #2
0
        public void CollectLogsTest()
        {
            TestUtility.TestProlog();

            string traceLogPath = Utility.GenerateProgramFilePath(Program.Config.WorkingDirectoryPath, ".log");

            using (TraceLogger traceLogger = new TraceLogger(traceLogPath))
            {
                FirewallInfoCollectorTest collector = new FirewallInfoCollectorTest(traceLogger);
                collector.CollectLogs();

                Assert.AreEqual(1, collector.CollectionResult.Count);
                Assert.AreEqual(1, collector.GeneratedLogs.Count);
                string outputFilePath = Program.Config.WorkingDirectoryPath + "\\Firewall.xml";
                Assert.IsTrue(File.Exists(outputFilePath));
                File.Delete(outputFilePath);
            }

            File.Delete(traceLogPath);
            TestUtility.TestEpilog();
        }