public void Test_calling_action_with_wrong_param_type_fails() { int value = 0; var state = new ActionState(false).AddAction <int>("Action", param => value = param); Assert.Throws <InvalidOperationException>(() => state.OnAction <bool>("Action", false)); }
public void Test_calling_non_existant_action_with_param_does_nothing() { int value = 0; var state = new ActionState(false).AddAction <int>("Action", param => value = param); state.OnAction <int>("NonExistantAction", 0); Assert.AreEqual(0, value); }
public void Test_calling_non_existant_action_does_nothing() { bool called = false; var state = new ActionState(false).AddAction("Action", () => called = true); state.OnAction("NonExistantAction"); Assert.IsFalse(called); }
public void Test_calling_existing_action_with_param_works() { int value = 0; var state = new ActionState(false).AddAction <int>("Action", param => value = param); state.OnAction <int>("Action", 5); Assert.AreEqual(5, value); }
public void Test_calling_existing_action_works() { bool called = false; var state = new ActionState(false).AddAction("Action", () => called = true); Assert.IsFalse(called); state.OnAction("Action"); Assert.IsTrue(called); }