Ejemplo n.º 1
0
        public void TestExecutablePropertiesEvent() {
            String eventPropertyChanged = String.Empty;

            var tester = new ExecutableBasicTester();

            tester.PropertyChanged += (sender, args) => { eventPropertyChanged = args.PropertyName; };
            tester.TestNumber = 10;

            Assert.AreEqual("TestNumber", eventPropertyChanged);
        }
Ejemplo n.º 2
0
        public void TestExecutableBasicCustomSetInvalidTypeCast() {
            var tester = new ExecutableBasicTester() {
                TestNumber = 0
            };

            tester.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                Name = "CustomSet",
                Parameters = new List<ICommandParameter>() {
                    new CommandParameter() {
                        Data = {
                            Content = new List<string>() {
                                "cheese"
                            }
                        }
                    }
                }
            });

            Assert.AreEqual(tester.TestNumber, 0);
        }
Ejemplo n.º 3
0
        public void TestExecutableBasicCustomSet() {
            var tester = new ExecutableBasicTester() {
                TestNumber = 0
            };

            tester.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                Name = "CustomSet",
                Parameters = new List<ICommandParameter>() {
                    new CommandParameter() {
                        Data = {
                            Content = new List<string>() {
                                50.ToString(CultureInfo.InvariantCulture)
                            }
                        }
                    }
                }
            });

            Assert.AreEqual(tester.TestNumber, 50);
        }
Ejemplo n.º 4
0
        public void TestExecutableDisposedEvent() {
            var requestWait = new AutoResetEvent(false);
            var tester = new ExecutableBasicTester();

            tester.Disposed += (sender, args) => requestWait.Set();

            tester.Dispose();

            Assert.IsTrue(requestWait.WaitOne(60000));
        }
Ejemplo n.º 5
0
        public void TestExecutableBasicSetValidTypeCast() {
            var tester = new ExecutableBasicTester() {
                TestNumber = 0
            };

            tester.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesSet,
                Parameters = new List<ICommandParameter>() {
                    new CommandParameter() {
                        Data = {
                            Content = new List<string>() {
                                "50"
                            }
                        }
                    }
                }
            });

            Assert.AreEqual(tester.TestNumber, 50);
        }
Ejemplo n.º 6
0
        public void TestExecutableBasicGet() {
            var tester = new ExecutableBasicTester() {
                TestNumber = 33
            };

            ICommandResult result = tester.Tunnel(new Command() {
                Origin = CommandOrigin.Local,
                CommandType = CommandType.VariablesGet
            });
            // ICommandResult result = tester.Execute(Command.Local, new CommandExecutableAttribute() { CommandType = CommandType.VariablesGet });

            Assert.AreEqual(tester.TestNumber, result.Now.Variables.First().ToType<int>());
        }