private void ProcessClaim()
        {
            Queue <Claim> claims       = claimsRepo.GetClaimQueue();
            bool          processClaim = true;

            if (claims.Count > 0)
            {
                while (processClaim)
                {
                    Claim c = claims.Peek();
                    DisplayClaim(c);
                    Console.WriteLine("Do you want to deal with this claim now(y/n)?");
                    string input = Console.ReadLine();
                    if (input == "y")
                    {
                        Claim temp = claimsRepo.ProcessClaim();
                        Console.WriteLine($"Claim {temp.ClaimID} has been processed and removed.");
                        Console.WriteLine("Please press any key to continue...");
                        Console.ReadKey();
                    }
                    if (input == "n")
                    {
                        processClaim = false;
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public void TestAddToQueue()
        {
            ClaimsRepo claimsRepo = new ClaimsRepo();
            Claim      testClaim  = new Claim();

            Assert.AreEqual(0, claimsRepo.GetClaimQueue().Count);
            claimsRepo.AddClaimToQueue(testClaim);
            Assert.AreEqual(1, claimsRepo.GetClaimQueue().Count);
        }
Ejemplo n.º 3
0
        public void TestProcessClaim()
        {
            ClaimsRepo claimsRepo = new ClaimsRepo();

            DateTime dateOfIncident01 = new DateTime(2018, 04, 25);
            DateTime dateOfClaim01    = new DateTime(2018, 04, 27);
            Claim    testClaim01      = new Claim(1, ClaimType.Car, "Car accident on 465.", 400.00m, dateOfIncident01, dateOfClaim01, true);

            claimsRepo.AddClaimToQueue(testClaim01);
            // ensuring claim was added to queue before testing dequeue
            Assert.AreEqual(1, claimsRepo.GetClaimQueue().Count);
            // testing that dequeue removed the one added claim from queue
            claimsRepo.ProcessClaim();
            Assert.AreEqual(0, claimsRepo.GetClaimQueue().Count);
        }
        private void DisplayClaims() // this is formated to look like a table.
        {
            Console.Clear();
            Console.WriteLine("Claim ID".PadRight(8, ' ') + "\tType".PadRight(12, ' ') + "\tDescription".PadRight(40, ' ') + "\tAmount".PadRight(16, ' ') + "\tDate of Accident".PadRight(18, ' ') + "\tDate of Claim".PadRight(18, ' ') + "\t\tIs Valid".PadRight(8, ' ') + "\n");

            //string test = "steven";
            //string testing = "grootaert";
            //Console.WriteLine("{0,-10}{1,-10}", test, testing);
            Queue <Claim> queueOfClaims = _claimsQueue.GetClaimQueue();

            // string interp of CLAIM01
            // string interp of CLAIM02
            foreach (Claim claim in queueOfClaims)
            {
                Console.WriteLine($"  {claim.ClaimID}".PadRight(8, ' ') + $"\t{claim.TypeOfClaim}".PadRight(12, ' ') + $"\t{claim.Description}".PadRight(40, ' ') + $"\t${claim.ClaimAmount}".PadRight(16, ' ') + $"\t{claim.DateOfIncident.ToShortDateString()}".PadRight(18, ' ') + $"\t{claim.DateOfClaim.ToShortDateString()}".PadRight(18, ' ') + $"\t\t{claim.IsValid}\n".PadRight(8, ' '));
            }
        }