public void TestAddCommand()
        {
            var connection = new TestConnection();
            var otao       = new TestOneTimeAccessOperator();
            var ota        = new Jupiter.Models.OneTimeAccessModel(connection, otao);

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

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

            Add(ota, "Var1", 12345, BuiltInType.Integer);
            ((VariableInfo)ota.OneTimeAccessItems[0]).PropertyChanged += (object sender, System.ComponentModel.PropertyChangedEventArgs e) => {
                ota.OneTimeAccessSelectedItems = new ObservableCollection <VariableInfo>();
                ota.OneTimeAccessSelectedItems.Add(sender);
            };
            ota.DeleteOneTimeAccessItemsCommand.Execute(null);
            Assert.AreEqual(ota.OneTimeAccessItems.Count, 0);
        }
        public void TestStateOfWriteCommand()
        {
            var  connection = new TestConnection();
            var  otao       = new TestOneTimeAccessOperator();
            var  ota        = new Jupiter.Models.OneTimeAccessModel(connection, otao);
            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);
        }