Beispiel #1
0
        private void AddClaimToList()
        {
            Console.Clear();
            Claims newClaim = new Claims();

            Console.WriteLine("Enter the Claim Id:");
            newClaim.ClaimId = int.Parse(Console.ReadLine());
            Console.WriteLine("Enter the Claim Type Number:\n" +
                              "1.Auto\n" +
                              "2.Home\n" +
                              "3.Theft");
            string claimTypeAsString = Console.ReadLine();
            int    claimAsInt        = int.Parse(claimTypeAsString);

            newClaim.TypeOfClaim = (ClaimType)claimAsInt;
            Console.WriteLine("Enter the Claim Description:");
            newClaim.Description = Console.ReadLine();
            Console.WriteLine("Amount of Damage");
            string amountAsString = Console.ReadLine();

            newClaim.ClaimAmount = double.Parse(amountAsString);
            Console.WriteLine("Date of Incident(yyyy/mm/dd)");
            newClaim.DateOfIncident = DateTime.Parse(Console.ReadLine());
            Console.WriteLine("Date of Claim(yyyy/mm/dd)");
            newClaim.DateOfClaim = DateTime.Parse(Console.ReadLine());
            Console.ReadKey();
            _claimsRepo.AddClaimToList(newClaim);
            Console.WriteLine("You have added a new Claim to the Queue");
            Console.ReadLine();
        }
        public void AddClaimToListTest()
        {
            _claimsList.AddClaimToList(_claims);
            int expected = 1;
            int actual   = _claimsList.GetClaims().Count;

            Assert.AreEqual(expected, actual);
        }
Beispiel #3
0
        public void ATestMethodOfYourName()
        {
            ClaimsList majorOof          = new ClaimsList(3448, "Car", "Car accident on 465", 400.00, new DateTime(2018, 4, 25), new DateTime(2018, 4, 27));
            ClaimsList oohBurn           = new ClaimsList(9723, "Home", "House fire in kitchen", 4000.00, new DateTime(2018, 4, 11), new DateTime(2018, 4, 12));
            ClaimsList seriouslyPancakes = new ClaimsList(6666, "Theft", "Stolen Pancakes", 400.00, new DateTime(2018, 4, 27), new DateTime(2018, 6, 01)); //Raise his rates. Why would you file a claim for stolen pancakes over a month later?

            _repo.AddClaimToList(majorOof);
            _repo.AddClaimToList(oohBurn);
            _repo.AddClaimToList(seriouslyPancakes);
        }
Beispiel #4
0
        private void NewClaim()
        {
            Console.Clear();
            Claims newClaim = new Claims();

            Console.WriteLine("Enter the claim ID:");
            string newClaimIDAsString = Console.ReadLine();

            newClaim.ClaimID = int.Parse(newClaimIDAsString);

            Console.WriteLine("Enter the Claim Type:\n" +
                              "1. Car\n" +
                              "2. Home\n" +
                              "3. Theft");

            string claimTypeAsString = Console.ReadLine();
            int    claimTypeAsInt    = int.Parse(claimTypeAsString);

            newClaim.TypeOfClaim = (ClaimType)claimTypeAsInt;

            Console.WriteLine("Enter a Description for the claim:");
            newClaim.Description = Console.ReadLine();

            Console.WriteLine("Damag amount reported (Format 0.00):");
            string amountAsString = Console.ReadLine();

            newClaim.ClaimAmount = double.Parse(amountAsString);

            Console.WriteLine("Date of Accident (Format YYYY, MM, DD):");
            string dateOfIncidentString = Console.ReadLine();

            newClaim.DateOfIncident = Convert.ToDateTime(dateOfIncidentString);

            Console.WriteLine("Date of Claim (Format YYYY, MM, DD):");
            string dateOfClaimString = Console.ReadLine();

            newClaim.DateOfClaim = Convert.ToDateTime(dateOfClaimString);

            Console.WriteLine("Checking if claim is valid...\n");

            TimeSpan claimValid = newClaim.DateOfClaim - newClaim.DateOfIncident;

            if (claimValid.TotalDays > 30)
            {
                newClaim.IsValid = false;
            }
            else
            {
                newClaim.IsValid = true;
            }

            _claimsRepo.AddClaimToList(newClaim);
        }
        public void Arrange()
        {
            _repo   = new ClaimsRepo();
            _claims = new Claims(1, ClaimType.Car, "crash", 100.00m, DateTime.Parse("10/20/2020"), DateTime.Parse("10/27/2020"), true);

            _repo.AddClaimToList(_claims);
        }
Beispiel #6
0
        public void AddClaimToListShouldBeNonNull() //AddClaimToQueue
        {
            ClaimsRepo         _claimsRepo        = new ClaimsRepo();
            Queue <ClaimClass> _queueOfClaimClass = new Queue <ClaimClass>();
            ClaimClass         claimClass         = new ClaimClass(1, ClaimType.Car, "Car accident on 464", 400.00, DateTime.Parse("4/25/18"), DateTime.Parse("4/27/2020"), false);

            _claimsRepo.AddClaimToList(claimClass);
            int numberOfClaims = _queueOfClaimClass.Count;

            Assert.IsNotNull(numberOfClaims); //assert
        }
        private void AddNewClaim()
        {
            Console.Clear();
            Claims newClaim = new Claims();

            Console.WriteLine("Enter the claim ID number..");
            string numberAsString = Console.ReadLine();

            newClaim.ClaimID = int.Parse(numberAsString);

            Console.WriteLine("Enter the claim type...");
            Console.WriteLine("Enter the type of claim:\n" +
                              "1. Car\n" +
                              "2. Home\n" +
                              "3. Theft\n");

            string claimAsString = Console.ReadLine();
            int    claimAsInt    = int.Parse(claimAsString);

            newClaim.TypeOfClaim = (ClaimType)claimAsInt;

            Console.WriteLine("Enter description...");
            newClaim.Description = Console.ReadLine();

            Console.WriteLine("Enter the claim amount.. (please exclude $)");
            string priceAsString = Console.ReadLine();

            newClaim.ClaimAmount = decimal.Parse(priceAsString);

            Console.WriteLine("Enter the date of incident...(MM/dd/yyyy)");
            string dateAsString = Console.ReadLine();

            newClaim.DateOfIncident = DateTime.Parse(dateAsString);

            Console.WriteLine("Enter the date the claim was filed...MM/dd/yyyy");
            string input = Console.ReadLine();

            newClaim.DateOfClaim = DateTime.Parse(input);


            Console.WriteLine("Is this claim valid (y/n)");
            string isValidString = Console.ReadLine().ToLower();

            if (isValidString == "y")
            {
                newClaim.IsValid = true;
            }
            else
            {
                newClaim.IsValid = false;
            }

            _claimsRepo.AddClaimToList(newClaim);
        }
        public void GetClaimId_ShouldGetNotNull()
        {
            Claims claim = new Claims();

            claim.ClaimId = 1;
            ClaimsRepo repository = new ClaimsRepo();

            repository.AddClaimToList(claim);
            Claims contentFromDirectory = repository.GetClaimsByClaimId(1);

            Assert.IsNotNull(contentFromDirectory);
        }
        public void AddTest()
        {
            Claims claim = new Claims();

            claim.ClaimID = 1;
            ClaimsRepo repository = new ClaimsRepo();

            repository.AddClaimToList(claim);
            Claims claimFromDirectory = repository.GetClaimByID(1);

            Assert.IsNotNull(claimFromDirectory);
        }
Beispiel #10
0
        public void TestingViewByID()
        {
            ClaimsRepo claimsRepo = new ClaimsRepo();
            Claims     testClaim  = new Claims(9, ClaimType.Home, "House Fire", 75000.00, new DateTime(2020, 11, 21), new DateTime(2020, 12, 01), true);

            claimsRepo.AddClaimToList(testClaim);

            List <Claims> claimsList = claimsRepo.GetClaimsList();

            foreach (Claims claim in claimsList)
            {
                if (claim.ClaimID == testClaim.ClaimID)
                {
                    Assert.IsTrue(testClaim.ClaimID == 9);
                }
            }
        }
Beispiel #11
0
        public void TestingAddToList()
        {
            ClaimsRepo claimsRepo = new ClaimsRepo();
            Claims     testClaim  = new Claims(9, ClaimType.Home, "House Fire", 75000.00, new DateTime(2020, 11, 21), new DateTime(2020, 12, 01), true);

            claimsRepo.AddClaimToList(testClaim);

            List <Claims> claimsList = claimsRepo.GetClaimsList();

            bool claimIDIsEqual = false;

            foreach (Claims claim in claimsList)
            {
                if (claim.ClaimID == testClaim.ClaimID)
                {
                    claimIDIsEqual = true;
                    break;
                }
            }
            Assert.IsTrue(claimIDIsEqual);
        }
Beispiel #12
0
        public void TestingWorkedOnClaim()
        {
            ClaimsRepo claimsRepo = new ClaimsRepo();
            Claims     testClaim  = new Claims(9, ClaimType.Home, "House Fire", 75000.00, new DateTime(2020, 11, 21), new DateTime(2020, 12, 01), true);

            claimsRepo.AddClaimToList(testClaim);
            claimsRepo.WorkedOnClaim(9);

            List <Claims> claimsList = claimsRepo.GetClaimsList();

            bool wasDeleted = true;

            foreach (Claims claim in claimsList)
            {
                if (claim.ClaimID == 9 || testClaim.ClaimID == 9)
                {
                    wasDeleted = false;
                    break;
                }
            }
            Assert.IsTrue(wasDeleted);
        }
        public void InputNewClaim()
        {
            Console.Clear();
            Claim newClaim = new Claim();

            Console.WriteLine("Please input the Claim ID for this claim:");
            newClaim.ClaimID = int.Parse(Console.ReadLine());
            Console.WriteLine("Input the number associated with claim type:\n" +
                              "1.Car\n" +
                              "2.Home\n" +
                              "3.Theft");
            string claimType = Console.ReadLine();

            if (claimType == "1")
            {
                newClaim.ClaimType = ClaimType.Car;
            }
            else if (claimType == "2")
            {
                newClaim.ClaimType = ClaimType.Home;
            }
            else if (claimType == "3")
            {
                newClaim.ClaimType = ClaimType.Theft;
            }
            else
            {
                Console.WriteLine("Please input a vaild input.");
                Console.WriteLine("Returning you to the main menu.Hit enter to continue.");
                Console.ReadKey();
                Console.Clear();
                Menu();
            }
            Console.WriteLine("Please give this claim a description:");
            newClaim.Description = Console.ReadLine();
            Console.WriteLine("Please input the amount of damage:\n" +
                              "Do not input a '$',  numbers only. ");
            newClaim.ClaimAmount = double.Parse(Console.ReadLine());
            Console.WriteLine("Input the date the accident occured:\n" +
                              "(Use the following layout 'mm/dd/yy' )");
            newClaim.DateOfIncident = Console.ReadLine();
            Console.WriteLine("Input the date the claim was made:\n" +
                              "(Use the following layout 'mm/dd/yy' )");
            newClaim.DateOfClaim = Console.ReadLine();
            Console.WriteLine("Is this claim valid? (y/n)");
            string isValid = Console.ReadLine().ToLower();

            if (isValid == "y")
            {
                newClaim.IsValid = true;
            }
            else if (isValid == "n")
            {
                newClaim.IsValid = false;
            }
            else
            {
                Console.WriteLine("Please input a vaild input.");
                Console.WriteLine("Returning you to the main menu.Hit enter to continue.");
                Console.ReadKey();
                Console.Clear();
                Menu();
            }
            ClaimsRepo.AddClaimToList(newClaim);
        }
 public void Arrange()
 {
     _claimsList = new ClaimsRepo();
     _claims     = new Claims(3, ClaimType.Theft, "Stolen Pancakes", 4.00, new DateTime(2018, 06, 01), new DateTime(2018, 06, 20));
     _claimsList.AddClaimToList(_claims);
 }
 public void Arrange()
 {
     _claimsRepo = new ClaimsRepo();
     _claim      = new Claim(1, ClaimType.Car, "Car accident on 465.", 400.00, "4/25/18", "4/27/18", true);
     ClaimsRepo.AddClaimToList(_claim);
 }