public void DifferentReturnStringValueIsNotEqual()
        {
            var value = "SomeVal";
            var monad = new ValueMonad <String>(value);

            var asserterVisitor = new AssertValueVisitor <String>
            {
                ExpectedValue = "SomeOtherVal",
                AreEqual      = false
            };

            monad.Accept(asserterVisitor);
        }
        public void ReturnStringValueIsEqual()
        {
            var value = "SomeVal";
            var monad = new ValueMonad <String>(value);

            var asserterVisitor = new AssertValueVisitor <String>
            {
                ExpectedValue = value,
                AreEqual      = true
            };

            monad.Accept(asserterVisitor);
        }
        public void DifferentReturnIntValueIsNotEqual()
        {
            var value = 2020;
            var monad = new ValueMonad <Int32>(value);

            var asserterVisitor = new AssertValueVisitor <Int32>
            {
                ExpectedValue = 0,
                AreEqual      = false
            };

            monad.Accept(asserterVisitor);
        }
        public void ReturnIntValueIsEqual()
        {
            var value = 2020;
            var monad = new ValueMonad <Int32>(value);

            var asserterVisitor = new AssertValueVisitor <Int32>
            {
                ExpectedValue = value,
                AreEqual      = true
            };

            monad.Accept(asserterVisitor);
        }
예제 #5
0
        public void BindReturnsTheSecondValueOFDifferentType()
        {
            var firstVal    = 1;
            var firstMonad  = new ValueMonad <Int32>(firstVal);
            var secondMonad = firstMonad.Bind(val => new ValueMonad <String>($"First val is: {val}."));

            var asserterVisitor = new AssertValueVisitor <String>
            {
                ExpectedValue = "First val is: 1.",
                AreEqual      = true
            };

            secondMonad.Accept(asserterVisitor);
        }
예제 #6
0
        public void BindDoesntReturnADifferentValue()
        {
            var firstVal    = 1;
            var firstMonad  = new ValueMonad <Int32>(firstVal);
            var secondMonad = firstMonad.Bind(val => new ValueMonad <Int32>(val + 1));

            var asserterVisitor = new AssertValueVisitor <Int32>
            {
                ExpectedValue = 0,
                AreEqual      = false
            };

            secondMonad.Accept(asserterVisitor);
        }
예제 #7
0
        public void BindReturnsTheSecondValue()
        {
            var firstVal    = 1;
            var firstMonad  = new ValueMonad <Int32>(firstVal);
            var secondMonad = firstMonad.Bind(val => new ValueMonad <Int32>(val + 1));

            var asserterVisitor = new AssertValueVisitor <Int32>
            {
                ExpectedValue = firstVal + 1,
                AreEqual      = true
            };

            secondMonad.Accept(asserterVisitor);
        }