예제 #1
0
 public void FoldShouldWorkCorrectOnSameType()
 {
     Assert.AreEqual(24, FunctionsOnLists.Fold(new List <int>()
     {
         2, 3, 4
     }, 1, (cur, next) => cur * next));
 }
예제 #2
0
 public void FoldShouldWorkCorrectOnDifferentTypes()
 {
     Assert.AreEqual(24, FunctionsOnLists.Fold(new List <string>()
     {
         "aa", "aaa", "aaaa"
     }, 1, (cur, next) => cur * next.Length));
 }
예제 #3
0
 public void FilterShouldReturnsEmptyList()
 {
     Assert.IsEmpty(FunctionsOnLists.Filter(new List <string>()
     {
         "kek", "lol"
     }, x => x.Contains('a')));
     Assert.IsEmpty(FunctionsOnLists.Filter(new List <string>(), x => true));
 }
예제 #4
0
 public void FilterShouldWorkCorrectOnIntegers()
 {
     CollectionAssert.AreEqual(
         new List <int>()
     {
         1, 3
     },
         FunctionsOnLists.Filter(new List <int>()
     {
         1, 2, 3
     }, x => x % 2 == 1));
 }
예제 #5
0
파일: MapTests.cs 프로젝트: Ususucsus/hw
 public void MapShouldGiveCorrectResultOnDifferentTypes()
 {
     CollectionAssert.AreEqual(
         new List <bool>()
     {
         false, true, false
     },
         FunctionsOnLists.Map(new List <string>()
     {
         "kek", "KaRaNtIn", "lol"
     }, x => x.Contains('a')));
 }
예제 #6
0
파일: MapTests.cs 프로젝트: Ususucsus/hw
 public void MapShouldGiveCorrectResultOnIntegers()
 {
     CollectionAssert.AreEqual(
         new List <int>()
     {
         2, 4, 6
     },
         FunctionsOnLists.Map(new List <int>()
     {
         1, 2, 3
     }, x => x * 2));
 }
예제 #7
0
 public void FoldShouldWorkCorrectWithEmptyList()
 {
     Assert.AreEqual(173, FunctionsOnLists.Fold(new List <int>(), 173, (cur, next) => 0));
 }
예제 #8
0
파일: MapTests.cs 프로젝트: Ususucsus/hw
 public void MapShouldReturnEmptyListOnEmptyLists()
 {
     Assert.IsEmpty(FunctionsOnLists.Map(new List <string>(), x => string.Empty));
     Assert.IsEmpty(FunctionsOnLists.Map(new List <bool>(), x => x.ToString()));
 }