コード例 #1
0
        public void NewClaim()
        {
            Console.Clear();

            Claim newClaim = new Claim();

            Console.Write("Enter the Claim ID: ");
            // breaks if you don't input a number
            newClaim.ClaimID = int.Parse(Console.ReadLine());
            Console.Write("Choose a Claim Type: \n" +
                          "[1] Car\n" +
                          "[2] Home\n" +
                          "[3] Theft");
            string claimType = Console.ReadLine();

            switch (claimType)
            {
            case "1":
                newClaim.ClaimType = TypeOfClaim.Car;
                break;

            case "2":
                newClaim.ClaimType = TypeOfClaim.Home;
                break;

            case "3":
                newClaim.ClaimType = TypeOfClaim.Theft;
                break;

            default:
                Console.WriteLine("Not a valid Claim Type\n" +
                                  "Press any key to redirect...");
                Console.ReadKey();

                break;
            }
            Console.Write("Enter a Claim Description: ");
            newClaim.Description = Console.ReadLine();
            Console.Write("Enter the amount of damage: ");
            newClaim.ClaimAmount = int.Parse(Console.ReadLine());
            Console.Write("Enter the date of the accident: ");
            newClaim.DateOfIncindent = DateTime.Parse(Console.ReadLine());
            Console.Write($"Date of claim: {DateTime.Now.ToString("MM/dd/yyy")}\n");
            newClaim.DateOfClaim = DateTime.Now;
            claims.Enqueue(newClaim);
            Console.ReadLine();
            MainMenu();
        }
コード例 #2
0
        public void Enqueue_ShouldReturnTrue()
        {
            ClaimsRepo repo  = new ClaimsRepo();
            Claim      claim = new Claim();

            bool wasEnqueued = repo.Enqueue(claim);

            Assert.IsTrue(wasEnqueued);
        }
コード例 #3
0
        public void ViewNextClaim_ShouldReturnNotNull()
        {
            var repo  = new ClaimsRepo();
            var claim = new Claim();

            repo.Enqueue(claim);
            string isViewing = repo.ViewNextClaim();

            Assert.IsNotNull(isViewing);
        }
コード例 #4
0
        public void GetAllClaims_ShouldReturnNotNull()
        {
            var repo  = new ClaimsRepo();
            var claim = new Claim();

            repo.Enqueue(claim);
            List <Claim> getClaims = repo.GetAllClaims();

            Assert.IsNotNull(getClaims);
        }