예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
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);
        }
예제 #4
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);
        }