private void _ModelFunctionT1Test() { ModelFunction <int, int> function = new ModelFunction <int, int>(); function.BindHandler((i) => { Assert.AreEqual(1337, i); return(123); }); Assert.AreEqual(123, function.Invoke(1337)); LogAssert.Expect(LogType.Error, "Invoked ModelFunction with no function bound!"); Assert.AreEqual(default(int), new ModelFunction <int, int>().Invoke(1)); }
public void ModelFunctionTest() { ModelFunction <int> function = new ModelFunction <int>(); function.BindHandler(() => 123); Assert.AreEqual(123, function.Invoke()); LogAssert.Expect(LogType.Error, "Invoked ModelFunction with no function bound!"); Assert.AreEqual(default(int), new ModelFunction <int>().Invoke()); // Test generic versions _ModelFunctionT1Test(); _ModelFunctionT1T2Test(); }