コード例 #1
0
        public void FileExistsTest()
        {
            string csvFilePath    = @"c:\StockFile\stocklist.csv";
            var    textFileHandle = new TextFileHandle();
            bool   expected       = true;
            bool   actual         = textFileHandle.FileExists(csvFilePath);

            Assert.AreEqual(expected, actual);
        }
コード例 #2
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            /*Create an instance of the textFileHandle class*/
            var    textFileHandle = new TextFileHandle();
            string csvFilePath    = @"c:\StockFile\stocklist.csv";

            /*If stocklist file exists in the StockFile directory,
             * load form1 with DataGridView object. If stocklist file
             * does not exist in the directory, load form 2 with message
             * to add file in the correct directory*/
            if (textFileHandle.FileExists(csvFilePath))
            {
                Application.Run(new Form1());
            }
            else
            {
                Application.Run(new Form2());
            }
        }