Пример #1
0
        public void SortLeadsByLastName()
        {
            foreach (string line in File.ReadLines("TestInput1.txt"))
            {
                leads.AddLead(line);
            }
            List <Lead> sortedResult   = leads.SortByLastNameDescending();
            List <Lead> expectedResult = new List <Lead>();

            expectedResult.Add(new Lead("Homer", "Simpson", "House", "Foundation", new DateTime(2018, 6, 1)));
            expectedResult.Add(new Lead("Rusty", "Shackleford", "House", "Bunker", new DateTime(2018, 5, 15)));
            expectedResult.Add(new Lead("Dante", "Hicks", "Trailer", "Plumbing", new DateTime(2018, 5, 27)));
            expectedResult.Add(new Lead("Jim", "Harbaugh", "House", "Siding", new DateTime(2018, 7, 19)));
            expectedResult.Add(new Lead("Phillip", "Fry", "Condo", "Plumbing", new DateTime(2018, 10, 21)));

            CollectionAssert.AreEqual(expectedResult, sortedResult);
        }
Пример #2
0
        static void Main(string[] args)
        {
            LeadList leads = new LeadList();

            try
            {
                foreach (string line in File.ReadLines(args[0]))
                {
                    leads.AddLead(line);
                }

                Console.WriteLine("");
                Console.WriteLine("Sorted by Property Type Then Project:");
                foreach (Lead l in leads.SortByPropertyTypeThenProject())
                {
                    Console.WriteLine(l.StringToPrint());
                }
                Console.WriteLine("");
                Console.WriteLine("Sorted by Start Date:");
                foreach (Lead l in leads.SortByStartDate())
                {
                    Console.WriteLine(l.StringToPrint());
                }
                Console.WriteLine("");
                Console.WriteLine("Sorted by Last Name Descending:");
                foreach (Lead l in leads.SortByLastNameDescending())
                {
                    Console.WriteLine(l.StringToPrint());
                }

                Console.ReadLine();
            }
            catch
            {
                Console.WriteLine("Please Specify the file in the command line");
            }
        }