Пример #1
0
        public void Squash_WithValue_ReturnsValue()
        {
            IMaybe <IMaybe <int> > value = Maybe.Return <IMaybe <int> >(42.ToMaybe());

            var result = value.Squash();

            Assert.IsTrue(result.HasValue);
            Assert.AreEqual(42, result.Value);
        }
Пример #2
0
        public void Squash_WithNoValueInnerIMaybe_ReturnsNoValue()
        {
            IMaybe <IMaybe <int> > value = Maybe.Return <IMaybe <int> >(Maybe <int> .NoValue);

            Assert.IsTrue(Maybe <int> .NoValue == value.Squash());
        }
Пример #3
0
        public void Squash_WithNoValueOuterIMaybe_ReturnsNoValue()
        {
            IMaybe <IMaybe <int> > value = Maybe <IMaybe <int> > .NoValue;

            Assert.IsTrue(Maybe <int> .NoValue == value.Squash());
        }