Exemplo n.º 1
0
        public void Claims_AddToQueue_ShouldAddToQueue()
        {
            //arrange
            DateTime date    = new DateTime(19, 12, 20);
            Claims   content = new Claims(1, ClaimType.Home, "break in", 2000, DateTime.Now, date, false);

            //act
            claimRepo.AddToQueue(content);
            Queue <Claims> queue = claimRepo.GetQueue();

            var expected = queue.Count;
            var actual   = 1;

            //assert
            Assert.AreEqual(expected, actual);
        }
Exemplo n.º 2
0
        public void AddNewClaim()
        {
            Console.Clear();
            Console.WriteLine("What Is The Claim ID?");
            string claimIdAsString = Console.ReadLine();
            int    claimId         = 0;
            bool   correct         = IntTest(claimIdAsString);

            if (correct)
            {
                Console.Clear();
                claimId = int.Parse(claimIdAsString);
                Console.WriteLine($"You Have Successfully Set The Claim ID to {claimId}, Press enter to continue.");
                Console.ReadLine();

                Console.Clear();
                Console.WriteLine("What Is The Claim Type? Enter The Number.\n" +
                                  "1. Car\n" +
                                  "2. Home\n" +
                                  "3. Theft");
                string claimTypeAsString = Console.ReadLine();
                bool   correct2          = IntTest(claimTypeAsString);

                if (correct2)
                {
                    Console.Clear();
                    ClaimType type = (ClaimType)int.Parse(claimTypeAsString);
                    Console.Clear();
                    Console.WriteLine($"You have successfully set the type of claim to {type}, Press enter to continue.");
                    Console.ReadLine();

                    Console.Clear();
                    Console.WriteLine("What Description Would You Give This Claim?");
                    string description = Console.ReadLine();

                    Console.Clear();
                    Console.WriteLine("You have successfully set the description, Press enter to continue");
                    Console.ReadLine();

                    Console.Clear();
                    Console.WriteLine("What Is The Claim Amount?");
                    string claimAmountAsString = Console.ReadLine();
                    double claimAmount         = 0;
                    bool   correct3            = DoubleTest(claimIdAsString);

                    if (correct3)
                    {
                        claimAmount = double.Parse(claimAmountAsString);
                        Console.Clear();
                        Console.WriteLine($"You have successfully set the claim amount to {claimAmount}, Press enter to continue.");
                        Console.ReadLine();

                        Console.Clear();
                        Console.WriteLine("Enter The Date Of The Incident. (MM/DD/YY)");
                        string   dateAsString = Console.ReadLine();
                        DateTime dateOf       = DateTime.Parse(dateAsString);

                        Console.Clear();
                        Console.WriteLine($"You have successfully set the date to {dateOf}, Press enter to continue.");
                        Console.ReadLine();

                        Console.Clear();
                        Console.WriteLine("Enter The Date Of The Claim. (MM/DD/YY)");
                        string   dateAsString1 = Console.ReadLine();
                        DateTime dateOf1       = DateTime.Parse(dateAsString1);

                        Console.Clear();
                        Console.WriteLine($"You have successfully set the date to {dateOf1}, Press enter to continue.");
                        Console.ReadLine();

                        TimeSpan span         = dateOf1 - dateOf;
                        bool     isValidClaim = false;
                        if (span.Days > 30)
                        {
                            isValidClaim = false;
                            Console.Clear();
                            Console.WriteLine("This claim is not valid because it is was not within the 30 day period.");
                            Console.ReadLine();
                        }
                        else
                        {
                            isValidClaim = true;
                            Console.Clear();
                            Console.WriteLine("sdasa");
                            Console.ReadLine();
                        }


                        //Console.Clear();
                        //Console.WriteLine("Is This Claim Valid? (Y/N)");
                        //string isValidAsString = Console.ReadLine();
                        //bool isValid;
                        //switch (isValidAsString)
                        //{
                        //    case "Y":
                        //        isValid = true;
                        //        Console.WriteLine($"You have successfully set the claim to {isValidAsString}");
                        //        break;
                        //    case "y":
                        //        isValid = true;
                        //        Console.WriteLine($"You have successfully set the claim to {isValidAsString}");
                        //        break;
                        //    case "N":
                        //        isValid = false;
                        //        Console.WriteLine($"You have successfully set the claim to {isValidAsString}");
                        //        break;
                        //    case "n":
                        //        isValid = false;
                        //        Console.WriteLine($"You have successfully set the claim to {isValidAsString}");
                        //        break;
                        //    default:
                        //        AddNewClaim();
                        //        isValid = false;
                        //        break;
                        //}
                        Claims newContent = new Claims(claimId, type, description, claimAmount, dateOf, dateOf1, isValidClaim);
                        _newClaimRepo.AddToQueue(newContent);
                    }

                    else
                    {
                        Console.Clear();
                        Console.WriteLine("Please Enter A Valid Claim Amount Number, You Will Be Redirected, Press Enter.");
                        Console.ReadLine();
                        AddNewClaim();
                    }
                }

                else
                {
                    Console.Clear();
                    Console.WriteLine("Please Enter A Valid Claim Type, You Will Be Redirected, Press Enter.");
                    Console.ReadLine();
                    AddNewClaim();
                }
            }
            else
            {
                Console.Clear();
                Console.WriteLine("Please Enter A Valid Claim ID, You Will Be Redirected, Press Enter.");
                Console.ReadLine();
                AddNewClaim();
            }
        }