示例#1
0
        public void Person_OrderBy_TestMethod()
        {
            List <Person> lstPersons = new List <Person>()
            {
                new Person()
                {
                    FirstName = "BAKER", LastName = "THEODORE"
                },
                new Person()
                {
                    FirstName = "SMITH", LastName = "ANDREW"
                },
                new Person()
                {
                    FirstName = "KENT", LastName = "MADISON"
                },
                new Person()
                {
                    FirstName = "SMITH", LastName = "FREDRICK"
                }
            };

            List <Person> lstResult = new List <Person>()
            {
                new Person()
                {
                    FirstName = "BAKER", LastName = "THEODORE"
                },
                new Person()
                {
                    FirstName = "KENT", LastName = "MADISON"
                },
                new Person()
                {
                    FirstName = "SMITH", LastName = "ANDREW"
                },
                new Person()
                {
                    FirstName = "SMITH", LastName = "FREDRICK"
                }
            };

            IOrder orderBy = new PersonAscendingOrder();
            IEnumerable <Person> persons = orderBy.Order(lstPersons);
            List <Person>        ps      = new List <Person>(persons);

            Assert.IsTrue(Utils.IsEqual(lstResult, ps));
        }
示例#2
0
        public void Person_OrderBy_Null_Parameters_Throws_ArgumentNullException_TestMethod()
        {
            IOrder orderBy = new PersonAscendingOrder();

            Assert.Throws(typeof(ArgumentNullException), () => orderBy.Order(null));
        }