public void StartTest(bool isEnabled, bool isServiceable) { var task = new TcoMomentaryTask(); task._enabled.Synchron = isEnabled; task._isServiceable.Synchron = isServiceable; task._setOnRequest.Synchron = false; _logger.ClearLastMessage(); var expected = isEnabled && isServiceable; task.Start(); Assert.AreEqual(expected, task._setOnRequest.Synchron); if (expected) { Assert.AreEqual("Task '' started. {@sender}", _logger.LastMessage.message); Assert.IsInstanceOf <LogInfo>(_logger.LastMessage.payload); Assert.AreEqual("Information", _logger.LastMessage.serverity); } else { Assert.IsTrue(_logger.IsLastMessageEmpty()); } }
public void RecordTaskAction_get_set_test() { var task = new TcoMomentaryTask(); Assert.IsNull(task.RecordTaskAction); task.RecordTaskAction = (a, b) => Console.WriteLine(); Assert.IsNotNull(task.RecordTaskAction); }
public void LogPayloadPropertyTest() { var task = new TcoMomentaryTask(); task.LogPayloadDecoration = () => "hey I am payload".ToUpper(); var actual = task.LogPayloadDecoration(); Assert.AreEqual("hey I am payload".ToUpper(), actual); }
public void CanExecuteTest_enabled_serviceable(bool isEnabled, bool isServiceable) { var task = new TcoMomentaryTask(); task._enabled.Synchron = isEnabled; task._isServiceable.Synchron = isServiceable; var expected = isEnabled && isServiceable; var actual = task.CanExecute(new object()); Assert.AreEqual(expected, actual); }
public void ExecuteTest(bool isEnabled, bool isServiceable) { var task = new TcoMomentaryTask(); task._enabled.Synchron = isEnabled; task._isServiceable.Synchron = isServiceable; task._setOnRequest.Synchron = false; _logger.ClearLastMessage(); var expected = isEnabled && isServiceable; task.Execute(new object()); Assert.AreEqual(false, task._setOnRequest.Synchron); Assert.IsTrue(_logger.IsLastMessageEmpty()); }
public void button_up_task_enabled_execute() { var task = new TcoMomentaryTask(new MockRootObject(), string.Empty, string.Empty); task._isServiceable.Synchron = true; task._enabled.Synchron = true; var vm = new TcoMomentaryTaskViewModel() { Model = task }; vm.ButtonUp.Execute(null); Assert.IsFalse(vm.TcoMomentaryTask._setOnRequest.Synchron); }
public void TcoMomentaryTaskViewModelTest() { var task = new TcoMomentaryTask(new MockRootObject(), string.Empty, string.Empty); var vm = new TcoMomentaryTaskViewModel() { Model = task }; Assert.IsNotNull(vm); Assert.IsNotNull(vm.TcoMomentaryTask); Assert.IsNotNull(vm.Model); Assert.IsInstanceOf <TcoMomentaryTask>(vm.TcoMomentaryTask); Assert.IsInstanceOf <TcoMomentaryTask>(vm.Model); }
public void get_caption() { var task = new TcoMomentaryTask(new MockRootObject(), string.Empty, string.Empty); task.GetConnector().BuildAndStart(); task._isServiceable.Synchron = true; task._enabled.Synchron = true; task.AttributeName = "momentary task button"; task.AttributeStateOffDesc = "is off"; task.AttributeStateOnDesc = "is on"; var vm = new TcoMomentaryTaskViewModel() { Model = task }; Assert.AreEqual("momentary task button : is off", vm.Caption); task._state.Synchron = true; vm.UpdateCaption(); Assert.AreEqual("momentary task button : is on", vm.Caption); }
public void PexCtor() { var task = new TcoMomentaryTask(new MockRootObject(), string.Empty, string.Empty); Assert.IsNotNull(task); }
public void CodeProvider_get_default_when_null() { var task = new TcoMomentaryTask(); Assert.IsInstanceOf <TcoCore.Swift.TcoMomentaryTaskDefaultCodeProvider>(task.CodeProvider); }