private void DeleteClaim()
        {
            Console.WriteLine("Which item would you like to delete?");
            List <ClaimClass> claimContentList = _claimsRepo.GetclaimContent();
            int count = 0;

            foreach (ClaimClass claimContent in claimContentList)
            {
                count++;
                Console.WriteLine($"{count}. {claimContent.ClaimID}");
            }

            int DesiredClaim  = int.Parse(Console.ReadLine());
            int DesiredClaimT = DesiredClaim - 1;

            if (DesiredClaimT >= 0 && DesiredClaimT < claimContentList.Count)
            {
                ClaimClass DesiredclaimContent = claimContentList[DesiredClaimT];

                if (_claimsRepo.DeleteClaim(DesiredclaimContent))
                {
                    Console.WriteLine($"{DesiredclaimContent.ClaimID} was removed successfully!");
                }
                else
                {
                    Console.WriteLine("I'm Sorry, Mrs. Doe, I am unable to do that.");
                }
            }
            else
            {
                Console.WriteLine("No item has that number.");
            }
            Console.WriteLine("Press any key to continue.......");
            Console.ReadKey();
        }
Exemple #2
0
        private void NextClaim()
        {
            Console.Clear();
            ClaimClass claim = _claimRepository.PeekQueue();

            Console.WriteLine($"Here are the details for this claim \n" +
                              $"{claim.ClaimID} \n" +
                              $"{claim.ClaimType} \n" +
                              $"{claim.Description} \n" +
                              $"{claim.ClaimAmount} \n" +
                              $"{claim.DateOfIncident} \n" +
                              $"{claim.DateOfClaim} \n" +
                              $"{claim.IsValid}");
            Console.WriteLine("Do you want to deal with this claim now? (y/n)");
            string userInput = Console.ReadLine();

            if (userInput.ToLower() == "y")
            {
                _claimRepository.DeQueueClaim();
                Console.Clear();
                Console.WriteLine("The first claim has been pulled off the top of the queue. \n" +
                                  "Press any key to return to the main menu...");
                Console.ReadKey();
            }
            else
            {
                Console.Clear();
                Console.WriteLine("Press any key to return to the main menu");
                Console.ReadKey();
            }
        }
Exemple #3
0
        public void Arrange()
        {
            _claimsRepo = new ClaimsRepo();

            _claimClass = new ClaimClass();

            _claimsRepo.AddContentToDirectory(_claimClass);
        }
Exemple #4
0
        public void AddToDirectory_FingersCrossedBool()
        {
            ClaimClass claimContent = new ClaimClass();
            ClaimsRepo Repo         = new ClaimsRepo();

            bool addResult = Repo.AddContentToDirectory(claimContent);

            Assert.IsTrue(addResult);
        }
        public void AddClaimToDirectory_ShouldGetCorrectBoolean()
        {
            ClaimClass      testClaim  = new ClaimClass();
            ClaimRepository repository = new ClaimRepository();

            bool addClaim = repository.AddClaimToDirectory(testClaim);

            Assert.IsTrue(addClaim);
        }
Exemple #6
0
        private void SeedClaims()
        {
            var claimOne   = new ClaimClass(1, ClaimType.Car, "Car accident on 465", 400.00m, "4/25/18", "4/27/18", true);
            var claimTwo   = new ClaimClass(2, ClaimType.Home, "House fire in kitchen", 4000.00m, "4/11/18", "4/12/18", true);
            var claimThree = new ClaimClass(3, ClaimType.Theft, "Stolen pankcakes", 4.00m, "4/27/18", "6/01/18", false);

            _claimRepository.AddClaimToDirectory(claimOne);
            _claimRepository.AddClaimToDirectory(claimTwo);
            _claimRepository.AddClaimToDirectory(claimThree);
        }
Exemple #7
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 DisplayItems(ClaimClass claimContent)
 {
     Console.WriteLine($"ClaimID: {claimContent.ClaimID}\n" +
                       $"ClaimType: {claimContent.ClaimType}\n" +
                       $"Description: {claimContent.Description}\n" +
                       $"ClaimAmount: ${claimContent.ClaimAmount}\n" +
                       $"DateOfIncident: {claimContent.DateOfIncident.ToShortDateString()}\n" +
                       $"DateOfClaim: {claimContent.DateOfClaim.ToShortDateString()}\n" +
                       $"IsValid: {claimContent.IsValid}\n" +
                       $"\n" +
                       $"");
 }
        public void GetAllClaims_ShouldReturnCorrectCollection()
        {
            ClaimClass      testClaim  = new ClaimClass();
            ClaimRepository repository = new ClaimRepository();

            repository.AddClaimToDirectory(testClaim);

            Queue <ClaimClass> listOfClaims = repository.GetAllClaims();

            bool directoryHasClaims = listOfClaims.Contains(testClaim);

            Assert.IsTrue(directoryHasClaims);
        }
        private void NewClaim()
        {
            Console.Clear();
            ClaimClass claimContent = new ClaimClass();

            Console.WriteLine("Claim Creation Page!");

            Console.WriteLine("Please enter a claim ID number.");
            claimContent.ClaimID = int.Parse(Console.ReadLine());

            Console.WriteLine("Please enter the type of claim. Please select a number between 1-3.\n" +
                              "1: Car\n" +
                              "2: Home\n" +
                              "3: Theft");
            string claimType = Console.ReadLine();

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

            case "2":
                claimContent.ClaimType = ClaimType.Home;
                break;

            case "3":
                claimContent.ClaimType = ClaimType.Theft;
                break;

            default:
                Console.WriteLine("Please select a number between 1 and 3.");
                Console.ReadKey();
                break;
            }

            Console.WriteLine("Please enter claim description.");
            claimContent.Description = Console.ReadLine();

            Console.WriteLine("Please enter the amount of claim.");
            claimContent.ClaimAmount = double.Parse(Console.ReadLine());

            Console.WriteLine("Please set a date of incident in the format of YYYY/MM/DD.");
            claimContent.DateOfIncident = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("Please set a date of claim in the form of YYYY/MM/DD.");
            claimContent.DateOfClaim = DateTime.Parse(Console.ReadLine());

            _claimsRepo.AddContentToDirectory(claimContent);
        }
Exemple #11
0
        public void GetDirectory_Hopefully()
        {
            ClaimClass claimContent = new ClaimClass();

            ClaimsRepo Repoz = new ClaimsRepo();

            Repoz.AddContentToDirectory(claimContent);

            List <ClaimClass> Content = Repoz.GetclaimContent();

            bool directoriesGotclaimContent = Content.Contains(claimContent);

            Assert.IsTrue(directoriesGotclaimContent);
        }
Exemple #12
0
        public void GetList()
        {
            //Arrange
            ClaimClass      newObject = new ClaimClass();
            ClaimRepository repo      = new ClaimRepository();

            repo.AddClaimToList(newObject);

            //Act
            List <ClaimClass> listofClaims = repo.GetClaimClassList();

            //Assert
            bool directoryHasContent = listofClaims.Contains(newObject);

            Assert.IsTrue(directoryHasContent);
        }
        private void Seed()
        {
            DateTime incidents    = new DateTime(2021, 03, 25);
            DateTime claims       = new DateTime(2021, 03, 27);
            DateTime incidentsOne = new DateTime(2021, 03, 13);
            DateTime claimsOne    = new DateTime(2021, 03, 15);
            DateTime incidentsTwo = new DateTime(2021, 02, 18);
            DateTime claimsTwo    = new DateTime(2021, 02, 20);

            ClaimClass claimOne   = new ClaimClass(1, ClaimType.Car, "Car accident on 465.", 400.00d, incidents, claims);
            ClaimClass claimTwo   = new ClaimClass(2, ClaimType.Home, "House fire in kitchen.", 4000.00d, incidentsOne, claimsOne);
            ClaimClass claimThree = new ClaimClass(3, ClaimType.Theft, "Stolen bacon.", 40000000.00d, incidentsTwo, claimsTwo);

            _claimsRepo.AddContentToDirectory(claimOne);
            _claimsRepo.AddContentToDirectory(claimTwo);
            _claimsRepo.AddContentToDirectory(claimThree);
        }
        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();
        }
        //D
        public bool DeleteClaimFromList(ClaimClass claimsClass)
        {
            ClaimClass claim = GetClaimClassByClaimID("1");

            if (claim == null)
            {
                return(false);
            }

            int initialCount = _listOfClaimClass.Count;

            _listOfClaimClass.Remove(claim);
            if (initialCount > _listOfClaimClass.Count)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #16
0
        private void TakeCareofNextClaim()
        {
            Console.Clear();
            Queue <ClaimClass> _queueOfClaimClass = _claimsRepo.GetClaimClassQueue();

            Console.WriteLine("This is the next claim to handle: \n");
            ClaimClass nextClaim = _queueOfClaimClass.Peek();

            Console.WriteLine($"ID: {nextClaim.ClaimID}\n" +
                              $"Type: {nextClaim.TypeofClaim}\n" +
                              $"Amount ${nextClaim.ClaimAmount}\n" +
                              $"Date of Incident: {nextClaim.DateOfIncident.ToShortDateString()}\n" +
                              $"Date of Claim: {nextClaim.DateOfClaim.ToShortDateString()}\n" +
                              $"Is Valid: {nextClaim.IsValid}\n" +
                              $"Description: {nextClaim.Description}\n" +
                              "Would you like to take this claim? y/n\n");


            string input = Console.ReadLine();

            switch (input)
            {
            case "y":
                _queueOfClaimClass.Dequeue();
                Console.WriteLine("The claim is now assigned to you \n");
                break;

            case "n":
                Console.Clear();
                Menu();
                break;

            default:
                Console.WriteLine("Please select y or n");
                break;
            }
            Console.ReadLine();
        }
        //U
        public bool UpdateExistingClaimClass(string orginalClaimID, ClaimClass newClaimClass)
        {
            //Find
            ClaimClass oldClaim = GetClaimClassByClaimID(orginalClaimID);

            //Update
            if (oldClaim != null)
            {
                oldClaim.ClaimID        = newClaimClass.ClaimID;
                oldClaim.TypesOfClaims  = newClaimClass.TypesOfClaims;
                oldClaim.Description    = newClaimClass.Description;
                oldClaim.ClaimAmount    = newClaimClass.ClaimAmount;
                oldClaim.DateOfAccident = newClaimClass.DateOfAccident;
                oldClaim.DateOfClaim    = newClaimClass.DateOfClaim;
                oldClaim.IsValid        = newClaimClass.IsValid;

                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemple #18
0
        private void EnterNewClaim()
        {
            ClaimClass claim = new ClaimClass();

            Console.Clear();
            Console.WriteLine("Enter the claim ID:");
            claim.ClaimID = int.Parse(Console.ReadLine());

            Console.Clear();
            Console.WriteLine("Enter the claim type: \n" +
                              "1) Car \n" +
                              "2) Home \n" +
                              "3) Theft");
            string claimTypeResponse = Console.ReadLine();

            switch (claimTypeResponse)
            {
            case "1":
                claim.ClaimType = ClaimType.Car;
                break;

            case "2":
                claim.ClaimType = ClaimType.Home;
                break;

            case "3":
                claim.ClaimType = ClaimType.Theft;
                break;
            }

            Console.Clear();
            Console.WriteLine("Enter a claim description:");
            claim.Description = Console.ReadLine();

            Console.Clear();
            Console.WriteLine("Enter the amount of damage:");
            claim.ClaimAmount = decimal.Parse(Console.ReadLine());

            Console.Clear();
            Console.WriteLine("Enter the date of the incident:");
            claim.DateOfIncident = Console.ReadLine();

            Console.Clear();
            Console.WriteLine("Enter the date of the claim:");
            claim.DateOfClaim = Console.ReadLine();

            Console.Clear();
            Console.WriteLine("Was the claim valid? \n" +
                              "t for true \n" +
                              "f for False");
            string isClaimValid = Console.ReadLine();

            if (isClaimValid.ToLower() == "t")
            {
                claim.IsValid = true;
            }
            else
            {
                claim.IsValid = false;
            }

            _claimRepository.AddClaimToDirectory(claim);

            Console.Clear();
            Console.WriteLine("Your new claim has been added to the directory! \n" +
                              "Press any key to continue...");
            Console.ReadKey();
        }
Exemple #19
0
 public void Arrange()
 {
     _repo  = new ClaimRepository();
     _claim = new ClaimClass(1, ClaimType.Car, "rough times", 10000m, "2/22/22", "3/33/33", false);
     _repo.AddClaimToDirectory(_claim);
 }
Exemple #20
0
        public void PeakClaim_ShouldPeekClaim()
        {
            ClaimClass claim = _repo.PeekQueue();

            Assert.AreEqual(_claim, claim);
        }
Exemple #21
0
 private void DisplayAllPropsForSeeAllClaims(ClaimClass claim)
 {
     Console.WriteLine($"   {claim.ClaimID} |   {claim.ClaimType} | {claim.Description} | {claim.ClaimAmount} |   {claim.DateOfIncident}   |   {claim.DateOfClaim} | {claim.IsValid} \n");
 }
Exemple #22
0
        private void SeeAllClaims()
        {
            Console.Clear();
            ClaimClass newContent = new ClaimClass();

            //Option #1
            Console.WriteLine("Claim ID,Type Description Amount Date of Accident Date of Claim Is Valid");
            Console.WriteLine("1 Car, Car accident on 465,$400.00, 4.25.18, 4.27.18, true");
            Console.WriteLine("2, Home, House fire in Kitchen, $4000.00, 4/11/18 4/12/18, true");
            Console.WriteLine("3,Theft, Stolen pancakes, $4.00,4.27.18,6.1.18, false");
            Console.WriteLine("Press enter to move on to menu item #2");
            newContent.ClaimID = Console.ReadLine();

            //Option #2
            Console.WriteLine("ClaimID:1");
            Console.WriteLine("Type:Car");
            Console.WriteLine("Description");
            Console.WriteLine("Amount: $400");
            Console.WriteLine("Date of Accident: 4/25/18");
            Console.WriteLine("Date of Claim: 4/27/18");
            Console.WriteLine("True");
            Console.WriteLine("Do you want to deal with this claim now(y/n?");
            string isValidString = Console.ReadLine().ToLower();

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

            _contentRepo.AddClaimToList(newContent);

            //Option #3
            Console.WriteLine("Please enter new data about the a claim as you will be prompted:");
            Console.WriteLine("Press any key to continue.");
            newContent.Description = Console.ReadLine();

            Console.WriteLine("Enter the claim ID");
            Console.ReadLine();

            Console.WriteLine("Enter the claim type:");
            Console.ReadLine();

            Console.WriteLine("Enter a claim description:");
            Console.ReadLine();

            Console.WriteLine("Amount of damages:");
            Console.ReadLine();

            Console.WriteLine("Date of accident:");
            Console.ReadLine();

            Console.WriteLine("Date of claim:");
            Console.ReadLine();

            Console.WriteLine("Is this claim valid: y/n");
            Console.ReadLine();
        }
 //C
 public void AddClaimToList(ClaimClass claim)
 {
     _listOfClaimClass.Add(claim);
 }
Exemple #24
0
        private void AddClaim()
        {
            Console.Clear();
            ClaimClass newClaim = new ClaimClass();

            Console.WriteLine("Please enter the ID for the new claim: \n");
            newClaim.ClaimID = int.Parse(Console.ReadLine());
            Console.WriteLine("Please enter the number for the type of claim:\n" +
                              "1. Car\n" +
                              "2. Home\n" +
                              "3. Theft\n");
            string input = Console.ReadLine();

            switch (input)
            {
            case "1":
                newClaim.TypeofClaim = ClaimType.Car;
                break;

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

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

            default:
                Console.WriteLine("Please enter 1, 2, or 3");
                break;
            }
            Console.WriteLine("Please enter the amount of the claim: \n");
            newClaim.ClaimAmount = double.Parse(Console.ReadLine());

            Console.WriteLine("Please enter the date of the incident (mm/dd/yy):  \n");
            newClaim.DateOfIncident = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("Please enter the date the claim was filed (mm/dd/yy):  \n");
            newClaim.DateOfClaim = DateTime.Parse(Console.ReadLine());

            bool     isValid;
            string   validText;
            TimeSpan diff = newClaim.DateOfClaim - newClaim.DateOfIncident;

            if (diff.Days <= 30)
            {
                isValid   = true;
                validText = "Valid";
            }
            else
            {
                isValid   = false;
                validText = "not valid";
            }
            Console.WriteLine($"Your claim is {validText} \n");
            newClaim.IsValid = isValid;

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

            _claimsRepo.AddClaimToList(newClaim);

            Console.WriteLine("Claim added! Press any key to continue");
            Console.ReadLine();
            Console.Clear();
        }
Exemple #25
0
 public void Arrange()
 {
     _repo    = new ClaimRepository();
     _content = new ClaimClass(1, "Car accident on 465", 400, "4.25.2018", "4.27.2018", true, ClaimType.Car);
     _repo.AddClaimToList(_content);
 }
 public void TestMethod1()
 {
     ClaimClass claimClass  = new ClaimClass(1, "Car accident on 465", 400, "4.25.2018", "4.27.2018", true, ClaimType.Car);
     ClaimClass claimClass2 = new ClaimClass(2, "House fire in kitchen", 4000, "4.11.2018", "4.12.2018", true, ClaimType.Home);
     ClaimClass claimClass3 = new ClaimClass(3, "Stolen pancakes", 4, "4.27.2018", "6.01.2018", false, ClaimType.Theft);
 }