Example #1
0
        public void OptionAll()
        {
            // Option with value
            var optionInt = Option <int> .Some(12);

            Assert.IsTrue(optionInt.All(intValue => intValue == 12));
            Assert.IsFalse(optionInt.All(intValue => intValue == 13));

            // Empty option
            Option <int> emptyOptionInt = Option.None;

            Assert.IsFalse(emptyOptionInt.All(intValue => intValue == 12));

            // ReSharper disable once ReturnValueOfPureMethodIsNotUsed
            Assert.Throws <ArgumentNullException>(() => optionInt.All(null));
        }