Beispiel #1
0
        public void TestAddCommand()
        {
            var connection = new TestConnection();
            var otao       = new TestOneTimeAccessOperator();
            var varinfomgr = new VariableInfo();
            var ota        = new Jupiter.Models.OneTimeAccessModel(connection, otao, varinfomgr);

            Add(ota, "Var1", 12345, BuiltInType.Integer);
            Assert.AreEqual(ota.OneTimeAccessItems.Count, 1);
        }
Beispiel #2
0
        public void TestDeleteCommandWhen0RegisteredItems0Selected()
        {
            var connection = new TestConnection();
            var otao       = new TestOneTimeAccessOperator();
            var varinfomgr = new VariableInfo();
            var ota        = new Jupiter.Models.OneTimeAccessModel(connection, otao, varinfomgr);

            ota.DeleteOneTimeAccessItemsCommand.Execute(null);
            Assert.AreEqual(ota.OneTimeAccessItems.Count, 0);
        }
Beispiel #3
0
        public void TestDeleteCommandWhen1RegisteredItems0Selected()
        {
            var connection = new TestConnection();
            var otao       = new TestOneTimeAccessOperator();
            var varinfomgr = new VariableInfo();
            var ota        = new Jupiter.Models.OneTimeAccessModel(connection, otao, varinfomgr);

            Add(ota, "Var1", 12345, BuiltInType.Integer);
            ((VariableInfoBase)ota.OneTimeAccessItems[0]).PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                ota.OneTimeAccessSelectedItems = new ObservableCollection <VariableInfoBase>();
                ota.OneTimeAccessSelectedItems.Add(sender);
            };
            ota.DeleteOneTimeAccessItemsCommand.Execute(null);
            Assert.AreEqual(ota.OneTimeAccessItems.Count, 0);
        }
Beispiel #4
0
        public void TestStateOfWriteCommand()
        {
            var  connection = new TestConnection();
            var  otao       = new TestOneTimeAccessOperator();
            var  varinfomgr = new VariableInfo();
            var  ota        = new Jupiter.Models.OneTimeAccessModel(connection, otao, varinfomgr);
            bool flag;

            flag = ota.WriteCommand.CanExecute(null);
            Assert.AreEqual(flag, false);
            connection.Connected = true;
            flag = ota.WriteCommand.CanExecute(null);
            Assert.AreEqual(flag, false);
            Add(ota, "Var1", 12345, BuiltInType.Integer);
            flag = ota.ReadCommand.CanExecute(null);
            Assert.AreEqual(flag, true);
        }