示例#1
0
        private void TakeCareOfNextClaim()
        {
            Console.Clear();
            Claims nextClaim = _repo.PeekNextClaim();

            Console.WriteLine($"The next claim in the queue is ");
            Console.WriteLine($"Claim ID: {nextClaim.ClaimID}\n" +
                              $"Claim Type: {nextClaim.TypeOfClaim}\n" +
                              $"Claim Description: {nextClaim.Description}\n" +
                              $"Claim Amount: {nextClaim.ClaimAmount}\n" +
                              $"Date Of Incident: {nextClaim.DateOfIncident.ToShortDateString()}\n" +
                              $"Date Of Claim: {nextClaim.DateOfClaim.ToShortDateString()}\n" +
                              $"Is Claim Valid: {nextClaim.IsValid}\n");

            Console.WriteLine("Do you want to deal with this claim now(y/n)?");
            ///if y-dequeue  if n then back to the menu...
            string s = (Console.ReadLine().ToLower());

            if (s == "y")
            {
                _repo.DequeueClaim(nextClaim);
                Console.WriteLine("The claim was successfully handled.");
            }
            if (s == "n")
            {
                Console.WriteLine($"The claim will remain in the queue.");
            }
            else
            {
                Console.WriteLine("Please enter a valid input.");
            }
        }
示例#2
0
        public void PeekNext_ShouldReturnNextClaim()
        {
            Claims      claim = new Claims();
            ClaimsRepo2 repo  = new ClaimsRepo2();

            repo.CreateNewClaim(claim);

            Queue <Claims> newQueue = new Queue <Claims>();

            newQueue.Enqueue(repo.PeekNextClaim());
            bool hasClaim = newQueue.Contains(claim);

            Assert.IsTrue(hasClaim);
        }