public void CustomListAddRangeMethodShouldAddTheElementsWhenGivenList() { var testList = new CustomList <int>(); testList.Add(1); testList.Add(2); testList.Add(3); testList.Add(4); testList.Add(5); var expextedResult = list.Count + testList.Count; list.AddRange(testList); Assert.AreEqual(expextedResult, list.Count); }
public void FirstOrDefault_FirstNumberEquals100_ReturnDefault() { CustomList <int> intList = new CustomList <int>(); intList.AddRange(new int[] { 1, 2, 4, 5, 6, 7, 8, 10 }); var res = intList.FirstOrDefault(i => i.Equals(100)); Assert.Equal(default, res);
private CustomList <SECURITY.DAO.MenuSetup> GetMenuList() { CustomList <SECURITY.DAO.MenuSetup> _List = new CustomList <SECURITY.DAO.MenuSetup>(); _List.Add(new SECURITY.DAO.MenuSetup { MenuID = "0", DisplayMember = "Home" }); _List.AddRange(manager.GellAllMenu()); return(_List); }
public void Concat_ConcatTwoLists_ReturnCountOfConcatenation16() { CustomList <string> moreFilm = new CustomList <string>(); moreFilm.AddRange(new string[] { "Inception", "Back to the Future", "Snatch.", "It's a Wonderful Life" }); var res = films.Concat(moreFilm).Count(); Assert.Equal(15, res); }
public void Count_Add3ItemsAndCount_Return3() { CustomList <int> intList = new CustomList <int>(); intList.AddRange(new int[] { 1, 2, 3 }); var res = intList.Count; Assert.Equal(3, res); }
public void Indexer_IndexBetween0AndCount_ReturnValue() { CustomList <int> intList = new CustomList <int>(); intList.Clear(); intList.AddRange(new int[] { 1, 5, 8, 2, 6, 9, 3, 7, 0 }); var res = intList[5]; Assert.Equal(9, res); }
public void AddRangeFailTest() { IList <int> ilistNumber = null; Should.Throw <ArgumentNullException>(() => ilistNumber.AddRange(null)); ilistNumber = new List <int>(); Should.Throw <ArgumentNullException>(() => ilistNumber.AddRange(null)); ilistNumber = new CustomList <int>(); Should.Throw <ArgumentNullException>(() => ilistNumber.AddRange(null)); }
public void AddRangeBoolTest() { IList <bool> ilistBool = new List <bool>(); CustomList <bool> customListBool = new CustomList <bool>(); List <bool> listBool = new List <bool>(); IEnumerable <bool> boolToAdd = GenerateFactory.GenerateRandomBool().Take(20).ToList(); ilistBool.AddRange(boolToAdd); customListBool.AddRange(boolToAdd); listBool.AddRange(boolToAdd); ilistBool.ShouldBe(listBool); customListBool.ShouldBe(listBool); }
public void AddRangeFloatTest() { IList <float> ilistFloat = new List <float>(); CustomList <float> customListFloat = new CustomList <float>(); List <float> listFloat = new List <float>(); IEnumerable <float> floatToAdd = GenerateFactory.GenerateRandomFloat(0, 20).Take(20).ToList(); ilistFloat.AddRange(floatToAdd); customListFloat.AddRange(floatToAdd); listFloat.AddRange(floatToAdd); ilistFloat.ShouldBe(listFloat); customListFloat.ShouldBe(listFloat); }
public void AddRangeStringTest() { IList <string> ilistString = new List <string>(); CustomList <string> customListString = new CustomList <string>(); List <string> listString = new List <string>(); IEnumerable <string> stringToAdd = GenerateFactory.GenerateRandomString(10).Take(20).ToList(); ilistString.AddRange(stringToAdd); customListString.AddRange(stringToAdd); listString.AddRange(stringToAdd); ilistString.ShouldBe(listString); customListString.ShouldBe(listString); }
public void AddRangeNumberTest() { IList <int> ilistNumber = new List <int>(); CustomList <int> customListNumber = new CustomList <int>(); List <int> listNumber = new List <int>(); IEnumerable <int> numberToAdd = GenerateFactory.GenerateRandomInt(0, 20).Take(20).ToList(); ilistNumber.AddRange(numberToAdd); customListNumber.AddRange(numberToAdd); listNumber.AddRange(numberToAdd); ilistNumber.ShouldBe(listNumber); customListNumber.ShouldBe(listNumber); }
public void Count_ShouldBeCorrectAfterUsingEveryPossibleOperation() { // Arange & Act CustomList <int> list = new CustomList <int>(2); //adds 1 list.Add(3); //adds 1 list.Insert(0, 1); list.AddRange(new int[] { 1, 2, 3 }); //adds 3 list[10] = 10; // adds 1 list[0] = 1; list.Remove(3); //removes 1 list.RemoveAt(0); //removes 1 //Assert Assert.Equal(list.Count(), list.Count); Assert.Equal(4, list.Count); }
public void AddRangeDatetimeTest() { IList <DateTime> ilistDatetime = new List <DateTime>(); CustomList <DateTime> customListDatetime = new CustomList <DateTime>(); List <DateTime> listDatetime = new List <DateTime>(); IEnumerable <DateTime> datetimeToAdd = GenerateFactory.GenerateRandomDate(DateTime.Now.AddYears(-1), DateTime.Now).Take(20).ToList(); ilistDatetime.AddRange(datetimeToAdd); customListDatetime.AddRange(datetimeToAdd); listDatetime.AddRange(datetimeToAdd); ilistDatetime.ShouldBe(listDatetime); customListDatetime.ShouldBe(listDatetime); }
public CustomStack(CustomList <T> list) : this() { stack.AddRange(list); }
public IteratorExtensionsTest() { films.AddRange(new string[] { "Fear and Loathing in Las Vegas", "Fight Club", "Filth", "Trainspotting", "A Clockwork Orange", "RocknRolla", "Revolver", "Three Billboards Outside Ebbing, Missouri", "Pulp Fiction", "Dazed and Confused", "Lock, Stock and Two Smoking Barrels" }); }
public CustomQueue(CustomList <T> list) : this() { queue.AddRange(list); }
private CustomList<SECURITY.DAO.MenuSetup> GetMenuList() { CustomList<SECURITY.DAO.MenuSetup> _List = new CustomList<SECURITY.DAO.MenuSetup>(); _List.Add(new SECURITY.DAO.MenuSetup { MenuID = "0", DisplayMember = "Home" }); _List.AddRange(manager.GellAllMenu()); return _List; }