コード例 #1
0
        public void GetPicksList()
        {
            //display the picks on the console screen
            GetPickListResponse response = new GetPickListResponse();

            response = service.GetPicks();

            Console.Clear();

            Console.WriteLine("Ticket Lists");
            ConsoleIO.LineSeparator();
            ConsoleIO.DisplayHeader();
            if (response.Success)
            {
                foreach (var p in response.picks)
                {
                    ConsoleIO.DisplayPickInfo(p);
                }
            }
            else
            {
                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine(response.Message);
                Console.ResetColor();
            }

            Console.WriteLine();
            Console.WriteLine("Press any key to continue...");
            Console.ReadKey();
        }
コード例 #2
0
ファイル: ServiceTests.cs プロジェクト: dannylith/MyWork
        public void CanNotGetPickLists()
        {
            IPickRepository repo    = new PickInFileRepository();
            Service         service = new Service(repo, new PickManual());

            GetPickListResponse actual = service.GetPicks();

            Assert.IsFalse(actual.Success);
            Assert.IsTrue(actual.picks.Count() == 0);
        }
コード例 #3
0
        public GetPickListResponse GetPicks()
        {
            GetPickListResponse response = new GetPickListResponse();
            List <Pick>         picks    = repo.GetPicksList();

            if (!picks.Any())
            {
                response.Success = false;
                response.Message = "There are no tickets bought.";
                response.picks   = picks;
                return(response);
            }
            response.Success = true;
            response.picks   = picks;
            return(response);
        }