public void ReturnExtensionTest() { var defaultValue = "Preceding expression returned NULL, default is returned."; var input = new Number(1); var result = input.With(x => x.Value == 1 ? x.ToString() : null).Return(x => x, defaultValue); Assert.AreEqual(result, "1"); result = input.With(x => x.Value > 1 ? x.ToString() : null).Return(x => x, defaultValue); Assert.AreEqual(result, defaultValue); }
public void WithExtensionTest() { var input = new Number(1); var result = input.With(x => x.ToString()).Return(x => x, null); Assert.AreEqual(result, "1"); var input2 = new Number(1); var result2 = input.With(x => new Number{Value = x.Value + 1}).Return(x => x, null); Assert.IsTrue(result2 is Number); Assert.AreEqual(result2.Value, 2); }