Exemplo n.º 1
0
 public void SetController(ScanningController controller)
 {
     this.controller = controller;
     this.controller.ExceptionOccured     += Controller_ExceptionOccured;
     this.controller.ScannerStatusChanged += Controller_ScannerStatusChanged;
     this.controller.SyncEvent            += Controller_SuccessfulSync;
     SelectScannerPort();
 }
Exemplo n.º 2
0
        public void TestGetAverageFileSize()
        {
            long expected = 62067 / 8;

            ScanningController scan = new ScanningController();
            string             path = "C:\\Users\\Ryan\\Desktop\\Reynolds_API\\UnitTestAPI\\TestFiles\\Scanning";
            long actual             = scan.getAverageFileSize(path);

            Assert.AreEqual(actual, expected);
        }
Exemplo n.º 3
0
        public void TestGetNumberOfDirectories()
        {
            long expected = 6;

            ScanningController scan = new ScanningController();
            string             path = "C:\\Users\\Ryan\\Desktop\\Reynolds_API\\UnitTestAPI\\TestFiles\\Scanning";
            long actual             = scan.getNumberOfDirectories(path);

            Assert.AreEqual(actual, expected);
        }
Exemplo n.º 4
0
        public void TestGetNumberOfFiles()
        {
            //37 Files in the TestFiles/Scanning Directory

            //Arrange
            long expected           = 8;
            ScanningController scan = new ScanningController();
            string             path = "C:\\Users\\Ryan\\Desktop\\Reynolds_API\\UnitTestAPI\\TestFiles\\Scanning";

            //Act
            long actual = scan.getNumberOfFiles(path);

            //Assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 5
0
        static void Main()
        {
            Logging.Logger("Starting application...");

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.ThreadException += Application_ThreadException;

            try
            {
                // GlobalSwitches.ServerOnline = CanReachServer();

                Logging.Logger("Loading attributes...");
                AttributeFunctions.PopulateAttributeIndexes();

                //Logging.Logger("Caching tables...");
                // if (GlobalSwitches.ServerOnline) CacheFunctions.CacheTables();

                Logging.Logger("Init Scanning UI...");
                var scanUI = new ScanningUI();

                Logging.Logger("Init Scanning Controller...");
                var scanController = new ScanningController(scanUI);

                Logging.Logger("Launch UI...");
                Application.Run(scanUI);
            }
            catch (Exception ex)
            {
                Logging.Logger("ERROR: " + ex.ToString());

                Console.WriteLine(ex.ToString());
                if (ex.InnerException != null)
                {
                    if (ex.InnerException.Message.Contains("connect"))
                    {
                        OtherFunctions.Message("Cannot connect to server.", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, "No Connection");
                        Application.Exit();
                    }
                }
                else
                {
                    OtherFunctions.Message(ex.ToString(), MessageBoxButtons.OK, MessageBoxIcon.Stop, "Error");
                }
            }
        }