Example #1
0
 public void Just_Bind_ReturnsNothing()
 {
     var just = new Just<string>("4");
     var just2 = just.Bind<string>(a => new Nothing<string>());
     var result = just2.FMap<int>(a => Int32.Parse(a));
     Assert.IsInstanceOf<Nothing<int>>(result);
 }
Example #2
0
        public void Just_Bind_ReturnsNothing()
        {
            var just   = new Just <string>("4");
            var just2  = just.Bind <string>(a => new Nothing <string>());
            var result = just2.FMap <int>(a => Int32.Parse(a));

            Assert.IsInstanceOf <Nothing <int> >(result);
        }
Example #3
0
 public void Just_Bind_ReturnsJust()
 {
     var just = new Just<string>("4");
     var just2 = just.Bind<string>(a => new Just<string>(a + "2"));
     var result = just2.FMap<int>(a => Int32.Parse(a));
     Assert.IsInstanceOf<Just<int>>(result);
     var actualResult = result as Just<int>;
     Assert.AreEqual(42, actualResult.Value);
 }
Example #4
0
        public void Just_Bind_ReturnsJust()
        {
            var just   = new Just <string>("4");
            var just2  = just.Bind <string>(a => new Just <string>(a + "2"));
            var result = just2.FMap <int>(a => Int32.Parse(a));

            Assert.IsInstanceOf <Just <int> >(result);
            var actualResult = result as Just <int>;

            Assert.AreEqual(42, actualResult.Value);
        }