コード例 #1
0
        public void Export()
        {
            var csvDelimiter   = AdvEnvironment.CSVDelimiter;
            var logViewModel   = new LogViewModel(eventLog);
            var expectedString = string.Format("Date{0} Action{0} AccessType{0} Path{0} ProcessPath\r\n", csvDelimiter);

            foreach (var logEntryData in logViewModel.Data)
            {
                expectedString += string.Format("{0}{5} {1}{5} {2}{5} {3}{5} {4}\r\n",
                                                logEntryData.Date,
                                                logEntryData.IsAllowed ? "Allow" : "Block",
                                                logEntryData.AccessType,
                                                logEntryData.Path,
                                                logEntryData.ProcessPath,
                                                csvDelimiter);
            }

            var exportedString = logViewModel.Export();

            Assert.AreEqual(expectedString, exportedString);
        }