Пример #1
0
        public void TestAddressesOutputValidation()
        {
            string csvFileName       = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "GoodCSV.csv");
            string addressesFileName = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "GoodAddresses.txt");

            CreateGoodCSV(csvFileName);
            ProcessFile processFile = new ProcessFile();
            var         result      = processFile.ValidateCSV(csvFileName);
            bool        hasHeader   = processFile.ValidateCSVHeader(csvFileName) == "True";

            result = processFile.ProcessCSV(csvFileName, hasHeader);
            result = processFile.ExportAddresses(addressesFileName);
            Assert.IsTrue((string.IsNullOrEmpty(result)) & (File.Exists(addressesFileName)) & (ValidateOutput(addressesFileName, BuildAddressValidationSet())));
            DeleteFile(csvFileName);
            DeleteFile(addressesFileName);
        }
Пример #2
0
        public void TestBadFile()
        {
            string csvFileName       = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "BadCSV.csv");
            string namesFileName     = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "BadNames.txt");
            string addressesFileName = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "BadAddresses.txt");

            CreateBadCSV(csvFileName);
            ProcessFile processFile = new ProcessFile();
            var         result      = processFile.ValidateCSV(csvFileName);
            bool        hasHeader   = processFile.ValidateCSVHeader(csvFileName) == "True";

            result = processFile.ProcessCSV(csvFileName, hasHeader);
            result = processFile.ExportNames(namesFileName);
            result = processFile.ExportAddresses(addressesFileName);
            Assert.IsTrue((!string.IsNullOrEmpty(result)) | (!File.Exists(namesFileName)) | (!File.Exists(addressesFileName)));
            DeleteFile(csvFileName);
            DeleteFile(namesFileName);
            DeleteFile(addressesFileName);
        }