public void IfNotNull_WithTarget_CallAction_ReturnSameType() { var target = new SomeTestClass(); var rtn = target.IfNotNull(() => target.MethodReturnVoid()); Assert.IsNotNull(rtn); Assert.AreSame(rtn, target); Assert.IsTrue(target.SomeMethodCalled); }
public void IfNotEmpty_WithFull_DoNotCallAction_ReturnNull() { var target = new SomeTestClass(); var result = _sequenceFull.IfEnumNotEmpty(x => target.MethodReturnVoid()); Assert.IsTrue(target.SomeMethodCalled); Assert.AreSame(result, _sequenceFull); }
public void IfEmpty_WithFull_DoNotCallAction_ReturnEmpty() { var target = new SomeTestClass(); var result = _sequenceFull.IfEnumEmpty(() => { Assert.Fail(); target.MethodReturnVoid(); }); Assert.AreSame(result, _sequenceFull); }
public void IfEmpty_WithNull_CallAction_ReturnEmpty() { var target = new SomeTestClass(); IEnumerable<string> result = _sequenceNull.IfEnumEmpty(() => target.MethodReturnVoid()); Assert.IsFalse(result.Any()); Assert.IsTrue(target.SomeMethodCalled); }
public void IfNotEmpty_WithString_CallActionString() { const string target = "a"; var someType = new SomeTestClass(); var result = target.IfNotEmpty(x => someType.MethodReturnVoid()); Assert.AreEqual(result, target); Assert.IsTrue(someType.SomeMethodCalled); }