public void HandleShouldNotCallIfSecondWhenEitherHasAFirstValue() { var called = false; var target = new Either<int, string>(1); target.Handle(_ => true, _ => called = true); Assert.That(!called); }
public void HandleShouldPassThroughFirstValueToIfFirst() { const uint value = 0x6a09e667; var target = new Either<uint, string>(value); target.Handle(f => { Assert.That(f, Is.EqualTo(value)); return true; }, _ => true); }
public void HandleShouldPassThroughIfSecondResult() { var target = new Either<uint, string>("1"); const decimal expected = 5m; Assert.That(target.Handle(_ => 0m, _ => expected), Is.EqualTo(expected)); }
public void HandleShouldPassThroughIfFirstResult() { var target = new Either<uint, string>(0x6a09e667); const decimal expected = 5m; Assert.That(target.Handle(_ => expected, _ => 0m), Is.EqualTo(expected)); }
public void HandleShouldPassThroughSecondValueToIfSecond() { const string value = "6a09e667"; var target = new Either<uint, string>(value); target.Handle(_ => true, s => { Assert.That(s, Is.EqualTo(value)); return true; }); }