Esempio n. 1
0
        public void TestMakeBatchEmptyTank()
        {
            Machine       mac = MachineController.InitializeMachine();
            Batch         newBatchFromEmpty;
            Batch         newBatchFromFull;
            PLCController plcFullTank  = new PLCController("PLCFullTank.txt");
            PLCController plcEmptyTank = new PLCController("PLCEmptyTank.txt");

            newBatchFromFull  = BatchController.MakeBatch_EmptyTank(plcFullTank, _type4);
            newBatchFromEmpty = BatchController.MakeBatch_EmptyTank(plcEmptyTank, _type4);

            Assert.AreEqual(mac.ID, newBatchFromEmpty.MachineID);
            Assert.AreEqual(mac.ID, newBatchFromFull.MachineID);

            Assert.IsTrue(plcFullTank.CheckMainTankIsEmpty());
            Assert.IsFalse(plcFullTank.CheckDischargeGateIsOpen());
            Assert.IsTrue(plcEmptyTank.CheckMainTankIsEmpty());
            Assert.IsFalse(plcEmptyTank.CheckDischargeGateIsOpen());
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="NewBatchWindow"/> class.
        /// </summary>
        public NewBatchWindow()
        {
            InitializeComponent();

            _machine = MachineController.InitializeMachine();

            _lblStatus1Dispatcher = lblStatus1.Dispatcher;
            _lblStatus2Dispatcher = lblStatus2.Dispatcher;
            _lblStatus3Dispatcher = lblStatus3.Dispatcher;
            _lblStatus4Dispatcher = lblStatus4.Dispatcher;
            _lblStatus5Dispatcher = lblStatus5.Dispatcher;
            _lblStatus6Dispatcher = lblStatus6.Dispatcher;

            _worker = new BackgroundWorker();
            _worker.WorkerReportsProgress      = true;
            _worker.WorkerSupportsCancellation = true;
            _worker.DoWork             += worker_MakeBatch;
            _worker.ProgressChanged    += new ProgressChangedEventHandler(worker_ProgressChanged);
            _worker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(worker_RunWorkerCompleted);

            //Load batch types into combo box
            try
            {
                _batchTypes = BatchTypeController.GetAllBatchTypes();
            }
            catch
            {
                MessageBox.Show("Error retrieving batch types from database.", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                return;
            }

            if (_batchTypes.Count <= 0)
            {
                MessageBox.Show("No batch types found.", "Notice!", MessageBoxButton.OK, MessageBoxImage.Asterisk);
                return;
            }

            cboBatchTypes.ItemsSource   = _batchTypes;
            cboBatchTypes.SelectedIndex = 0;
        }
Esempio n. 3
0
 public void TestInitializeMachine()
 {
     _machine = MachineController.InitializeMachine();
     Assert.AreEqual("Machine1", _machine.ID);
 }
Esempio n. 4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainWindow"/> class.
        /// </summary>
        public MainWindow()
        {
            InitializeComponent();

            _machine = MachineController.InitializeMachine();
        }