Ejemplo n.º 1
0
        public void Handle_WhenEmpty_ReturnAbsentFunctionValue()
        {
            var handlePresent = new MockFunction <string>().RunReturns("present");
            var handleAbsent  = new MockFunction <string>().RunReturns("absent");
            var option        = Optional <string> .Empty();

            var result = option.Handle(value => handlePresent.Run(), () => handleAbsent.Run());

            Assert.Equal("absent", result);
            handlePresent.VerifyFunctionNotCalled();
            handleAbsent.VerifyFunctionCalled();
        }