Ejemplo n.º 1
0
        public void Select_Other_Class()
        {
            var people = new List <MathScore>
            {
                new MathScore()
                {
                    Name = "DD", Score = 100
                },
                new MathScore()
                {
                    Name = "EE", Score = 60
                },
                new MathScore()
                {
                    Name = "FF", Score = 10
                },
            };

            var excepted = new List <int> {
                100, 60, 10
            };
            var result = MySelectMethod.CCSelct(people, c => c.Score);

            Assert.AreEqual(excepted, result);
        }
Ejemplo n.º 2
0
        public void Select_NameAndAge()
        {
            var people = new List <Person>
            {
                new Person()
                {
                    Name = "AA", Age = 47, Gender = "M"
                },
                new Person()
                {
                    Name = "BB", Age = 27, Gender = "F"
                },
                new Person()
                {
                    Name = "CC", Age = 37, Gender = "M"
                },
            };

            var excepted = new List <Person>
            {
                new Person()
                {
                    Name = "AA", Age = 47
                },
                new Person()
                {
                    Name = "BB", Age = 27
                },
                new Person()
                {
                    Name = "CC", Age = 37
                },
            };
            var result = MySelectMethod.CCSelct(people, p => new Person()
            {
                Name = p.Name, Age = p.Age
            });

            Assert.AreEqual(excepted, result);
        }
Ejemplo n.º 3
0
        public void Select_Age()
        {
            var people = new List <Person>
            {
                new Person()
                {
                    Name = "AA", Age = 47, Gender = "M"
                },
                new Person()
                {
                    Name = "BB", Age = 27, Gender = "F"
                },
                new Person()
                {
                    Name = "CC", Age = 37, Gender = "M"
                },
            };

            var excepted = new List <int> {
                47, 27, 37
            };

            Assert.AreEqual(excepted, MySelectMethod.CCSelct(people, p => p.Age));
        }
Ejemplo n.º 4
0
        public void Select_Gender()
        {
            var people = new List <Person>
            {
                new Person()
                {
                    Name = "AA", Age = 47, Gender = "M"
                },
                new Person()
                {
                    Name = "BB", Age = 27, Gender = "F"
                },
                new Person()
                {
                    Name = "CC", Age = 37, Gender = "M"
                },
            };

            var excepted = new List <string> {
                "M", "F", "M"
            };

            Assert.AreEqual(excepted, MySelectMethod.CCSelct(people, p => p.Gender));
        }