Beispiel #1
0
        public void NewList_SubtractedList2_Operator()
        {
            NewList<int> one = new NewList<int>();
            NewList<int> two = new NewList<int>();
            string expected = "5";
            string actual;

            one.Add(1);
            one.Add(3);
            one.Add(5);
            one.Add(6);
            one.Add(8);

            two.Add(2);
            two.Add(1);
            two.Add(6);
            two.Add(11);
            two.Add(7);
            two.Add(8);
            two.Add(3);
            NewList<int> three = one - two;
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Beispiel #2
0
 public void NewList_CheckString_IntsToString()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     string expected = "5, 10, 15";
     string actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     actual = list.ToString();
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #3
0
 public void NewList_CheckString_StringToString()
 {
     //arrange
     NewList<string> list = new NewList<string>();
     string expected = "Charles, King, Mangos";
     string actual;
     //act
     list.Add("Charles");
     list.Add("King");
     list.Add("Mangos");
     actual = list.ToString();
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #4
0
        public void Add_AddingOverCapacityExdensArray()
        {
            NewList <int> list = new NewList <int> {
            };

            list.Add(1);
            list.Add(2);
            list.Add(3);
            list.Add(4);
            list.Add(5);
            var result = list.NewArray.Length;

            Assert.Equal(8, result);
        }
Beispiel #5
0
 public void NewList_CheckCount_RemoveString()
 {
     //arrange
     NewList<string> list = new NewList<string>();
     int expected = 2;
     int actual;
     //act
     list.Add("Charles");
     list.Add("King");
     list.Add("Mangos");
     list.Remove("King");
     actual = list.Count;
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #6
0
        public void NewList_CheckListOne_Count()
        {
            NewList<int> one = new NewList<int>();
            NewList<int> two = new NewList<int>();
            int expected = 3;
            int actual;

            one.Add(1);
            one.Add(3);
            one.Add(5);
            two.Add(2);
            two.Add(4);
            two.Add(6);
            actual = one.Count;
            Assert.AreEqual(expected, actual);
        }
Beispiel #7
0
        public void CheckFiles()
        {
            string[] files = Directory.GetFiles(Settings.Client, "*.*" ,SearchOption.AllDirectories);

            for (int i = 0; i < files.Length; i++)
                NewList.Add(GetFileInformation(files[i]));
        }
        public void CompareListsTwoDifferentListTypes()
        {
            List <Person> list1 = new List <Person>();

            list1.Add(new Person()
            {
                Name = "Logan 5"
            });
            list1.Add(new Person()
            {
                Name = "Francis 7"
            });

            NewList <Person> list2 = new NewList <Person>(list1);

            ComparisonConfig config = new ComparisonConfig();

            config.IgnoreObjectTypes = true;

            CompareLogic compareLogic = new CompareLogic(config);
            var          result       = compareLogic.Compare(list1, list2);

            Assert.IsTrue(result.AreEqual);

            list2.Add(new Person()
            {
                Name = "Roger 4"
            });

            result = compareLogic.Compare(list1, list2);
            Assert.IsFalse(result.AreEqual);
        }
Beispiel #9
0
 public void NewList_CheckCount_Remove15()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     int numberRemoved = 15;
     int expected = 3;
     int actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     list.Add(20);
     list.Remove(numberRemoved);
     actual = list.Count;
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #10
0
 public void NewList_CheckOrder_Index0()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     int expected = 5;
     int index = 0;
     int actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     list.Add(20);
     list.Add(25);
     actual = list[index];
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #11
0
        public void NewList_ZipLists_LongerLists()
        {
            NewList<int> odd = new NewList<int>();
            NewList<int> even = new NewList<int>();
            string expected = "1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14";
            string actual;

            odd.Add(1);
            odd.Add(3);
            odd.Add(5);
            odd.Add(7);
            odd.Add(9);
            odd.Add(11);
            odd.Add(13);
            even.Add(2);
            even.Add(4);
            even.Add(6);
            even.Add(8);
            even.Add(10);
            even.Add(12);
            even.Add(14);
            NewList<int> three = odd.Zip(even);
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Beispiel #12
0
        public void NewList_ZipLists_EvensOdds()
        {
            NewList<int> odd = new NewList<int>();
            NewList<int> even = new NewList<int>();
            string expected = "2, 1, 4, 3, 6, 5";
            string actual;

            odd.Add(1);
            odd.Add(3);
            odd.Add(5);
            even.Add(2);
            even.Add(4);
            even.Add(6);
            NewList<int> three = even.Zip(odd);
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Beispiel #13
0
        public void NewList_ZipLists_OddsEvens()
        {
            NewList<int> odd = new NewList<int>();
            NewList<int> even = new NewList<int>();
            string expected = "1, 2, 3, 4, 5, 6";
            string actual;

            odd.Add(1);
            odd.Add(3);
            odd.Add(5);
            even.Add(2);
            even.Add(4);
            even.Add(6);
            NewList<int> three = odd.Zip(even);
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Beispiel #14
0
        public void NewList_CheckCombinedList_Operator()
        {
            NewList<int> one = new NewList<int>();
            NewList<int> two = new NewList<int>();
            string expected = "1, 3, 5, 2, 4, 6";
            string actual;

            one.Add(1);
            one.Add(3);
            one.Add(5);
            two.Add(2);
            two.Add(4);
            two.Add(6);
            NewList<int> three = one + two;
            actual = three.ToString();

            Assert.AreEqual(expected, actual);
        }
Beispiel #15
0
 public void NewList_CheckRemoved_Index2()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     int numberRemoved = 15;
     int index = 2;
     int expected = 20;
     int actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     list.Add(20);
     list.Remove(numberRemoved);
     actual = list[index];
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #16
0
        /// <summary>
        /// 检查client下所有文件信息,并加入到 新列表 内
        /// </summary>
        public void CheckFiles()
        {
            // 获取客户端目录下所有文件
            string[] files = Directory.GetFiles(Settings.Client, "*.*", SearchOption.AllDirectories);

            // 将文件信息组合并加入到 新列表 内
            for (int i = 0; i < files.Length; i++)
            {
                NewList.Add(GetFileInformation(files[i]));
            }
        }
Beispiel #17
0
 public void NewList_CheckCount_AddString()
 {
     //arrange
     string stringToAdd = "Charles";
     int expected = 1;
     int actual;
     NewList<string> list = new NewList<string>();
     //act
     list.Add(stringToAdd);
     actual = list.Count;
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #18
0
 public void NewList_CheckCount_AddPositiveInt()
 {
     //arrange
     int numberToAdd = 5;
     int expected = 1;
     int actual;
     NewList<int> list = new NewList<int>();
     //act
     list.Add(numberToAdd);
     actual = list.Count;
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #19
0
 public void NewListString_CheckIndex_Index0()
 {
     //arrange
     string stringToAdd = "Charles";
     int index = 0;
     string expected = "Charles";
     string actual;
     NewList<string> list = new NewList<string>();
     //act
     list.Add(stringToAdd);
     actual = list[index];
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #20
0
 public void NewList_CheckString_IntsToStringRemoved()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     string expected = "5, 15, 20, 25, 30, 40, 45, 10";
     string actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     list.Add(20);
     list.Add(25);
     list.Add(30);
     list.Add(35);
     list.Add(40);
     list.Remove(35);
     list.Add(45);
     list.Remove(10);
     list.Add(10);
     actual = list.ToString();
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #21
0
 public void NewList_CheckIndex_Index0()
 {
     //arrange
     int numberToAdd = 5;
     int index = 0;
     int expected = 5;
     int actual;
     NewList<int> list = new NewList<int>();
     //act
     list.Add(numberToAdd);
     actual = list[index];
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #22
0
        public void NewList_SubtractedListThreeCount_Operator()
        {
            NewList<int> one = new NewList<int>();
            NewList<int> two = new NewList<int>();
            int expected = 1;
            int actual;

            one.Add(1);
            one.Add(3);
            one.Add(5);
            one.Add(6);
            one.Add(8);
            two.Add(2);
            two.Add(1);
            two.Add(6);
            two.Add(11);
            two.Add(7);
            two.Add(8);
            two.Add(3);
            NewList<int> three = one - two;
            actual = three.Count;

            Assert.AreEqual(expected, actual);
        }
Beispiel #23
0
        static void Main(string[] args)
        {
            var n = int.Parse(Console.ReadLine());

            var list = new NewList();

            for (int i = 0; i < n; i++)
            {
                var x = int.Parse(Console.ReadLine());
                list.Add(x);
            }

            for (int i = 0; i < n; i++)
            {
                Console.WriteLine(list[i]);
            }
        }
Beispiel #24
0
        public void CreateData(List <AgendaEntity> loadedList)
        {
            int num = Helper.GetRandomNumber(1, 20);

            for (int i = 1; i <= num; i++)
            {
                NewList.Add(new NewsEntity("NewFlash", loadedList,
                                           Helper.FromIso8601Weeknumber(Helper.GetRandomNumber(14, 18), null,
                                                                        Helper.RandomEnum <DayOfWeek>()),
                                           new List <string> {
                    "asdas", "dasdasd"
                },
                                           Helper.RandomString(100),
                                           Helper.RandomString(10),
                                           Helper.RandomEnum <Constant.Domain>(),
                                           Helper.RandomString(10),
                                           Helper.RandomEnum <Constant.Domain>().ToFullDomain()
                                           ));
            }
            ReloadDataTableView();
        }
Beispiel #25
0
 public void RegisterNew(T obj)
 {
     NewList.Add(obj);
 }
Beispiel #26
0
 public void NewList_CheckCount_Remove45()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     int expected = 8;
     int actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     list.Add(20);
     list.Add(25);
     list.Add(30);
     list.Add(35);
     list.Add(40);
     list.Add(45);
     list.Add(50);
     list.Add(55);
     list.Remove(45);
     list.Remove(20);
     list.Remove(30);
     actual = list.Count;
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #27
0
 public void NewList_CheckCapacity()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     int expected = 16;
     int actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     list.Add(20);
     list.Add(25);
     list.Add(30);
     list.Add(35);
     list.Add(40);
     list.Add(45);
     list.Add(50);
     list.Add(55);
     actual = list.Capacity;
     //assert
     Assert.AreEqual(expected, actual);
 }
Beispiel #28
0
 /// <summary>
 /// Event handler for catching any creations within the associated
 /// watched folders and files.
 /// </summary>
 /// <param name="sender">The object sending the event</param>
 /// <param name="e">The arguments being sent by the event</param>
 private void SecondWatcher_Created(object sender, FileSystemEventArgs e)
 {
     NewList.Add(e.Name);
     Changed += "- CREATED -\r\n" + "Path: " + e.FullPath + "\r\n" +
                "Time Modified: " + DateTime.Now + "\r\n\r\n";
 }
Beispiel #29
0
 public void NewList_CheckOrder_Remove45()
 {
     //arrange
     NewList<int> list = new NewList<int>();
     int numberRemoved = 45;
     int index = 8;
     int expected = 55;
     int actual;
     //act
     list.Add(5);
     list.Add(10);
     list.Add(15);
     list.Add(20);
     list.Add(25);
     list.Add(30);
     list.Add(35);
     list.Add(40);
     list.Add(45);
     list.Add(50);
     list.Add(55);
     list.Remove(45);
     list.Remove(70);
     list.Remove(30);
     actual = list[index];
     //assert
     Assert.AreEqual(expected, actual);
 }