Example #1
0
        private void TakeCareOfNextClaim()
        {
            Claims nextClaim = _claimsRepo.DisplayNextClaim();

            if (nextClaim != null)
            {
                Console.WriteLine($"Claim ID: {nextClaim.ClaimID}\n" +
                                  $"Claim Type: {nextClaim.ClaimType}\n" +
                                  $"Description: {nextClaim.Description}\n" +
                                  $"Claim Amount: {nextClaim.ClaimAmount}\n" +
                                  $"Date of Incident: {nextClaim.DateOfIncident}\n" +
                                  $"Date of Claim: {nextClaim.DateOfClaim}\n" +
                                  $"Is Claim Valid: {nextClaim.IsValid}");
                Console.WriteLine("Do you want to deal with this claim now? (Please type Y/N).");
                string response = Console.ReadLine();
                if (response.ToUpper() == "Y")
                {
                    _claimsRepo.DeleteClaim();
                    Console.WriteLine("Claim was successfully removed.");
                }
                else
                {
                    Console.WriteLine("You'll deal with this claim later. \n" +
                                      "Press any key to continue......");
                    Console.ReadKey();
                    RunMenu();
                }
            }
        }
        //Delete
        private void DeleteClaims()
        {
            Console.Clear();
            ViewAllClaims();
            _claimsRepo.SeeNextClaim();

            Console.WriteLine("Would like to deal with this claim now y/n?");
            if (YesOrNo())
            {
                if (_claimsRepo.DeleteClaim())
                {
                    Console.WriteLine("Claim Id deleted successfully");
                }
                else
                {
                    Console.WriteLine("Claim cannot be deleted");
                }
            }

            Console.WriteLine("Would you like to deal with another claim?");
            if (YesOrNo())
            {
                DeleteClaims();
            }
        }
        public void RemoveClaim()
        {
            //Arange

            //Act
            bool removedClaim = _claimRepo.DeleteClaim(_claims);

            //Assert
            Assert.IsTrue(removedClaim);
        }
        private void NextClaim()
        {
            Console.Clear();

            ClaimClass claimClass = _claimsRepo.NextClaim();

            Console.WriteLine($"Claim: {claimClass.ClaimID} {claimClass.ClaimType} {claimClass.Description} {claimClass.ClaimAmount} {claimClass.DateOfIncident} {claimClass.DateOfClaim}");

            Console.WriteLine("Do you want to deal with this claim now? (y/n)");
            string userinput = Console.ReadLine();

            if (userinput == "y")
            {
                _claimsRepo.DeleteClaim(claimClass);
                Console.WriteLine("This claim was completed!");
            }
            Console.WriteLine("Please press any key to continue....");
            Console.ReadKey();
        }
        public void DeleteClaim_ShouldDeleteClaim()
        {
            Claims     content = new Claims();
            ClaimsRepo repo    = new ClaimsRepo();

            repo.AddClaimToQueue(content);
            Queue <Claims> getTheClaimsCollection = repo.GetEntireQueue();

            repo.DeleteClaim();
            bool directoryHasContent = getTheClaimsCollection.Contains(content);

            Assert.IsFalse(directoryHasContent);
        }