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); }
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); }
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); }
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)); }
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); }
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>()); }