public void Action_Synch_Once_1Argument() { string result = ""; var oncing = new Action <string>((a) => { result += string.Join("", a); }); var onced = _.Action.Once(oncing); for (var i = 0; i < 100; i++) { apply.Apply(onced, arguments); } Assert.AreEqual("a", result); }
public void Action_Synch_Before_2Arguments() { var beforing = new Action <string, string>((a, b) => { counter++; result += string.Join("", a, b, counter); invoked = true; }); var befored = _.Action.Before(beforing, 2); for (var i = 0; i < 4; i++) { apply.Apply(befored, arguments); } Assert.AreEqual("ab1ab2", result); Assert.IsTrue(invoked); }