public void SeedMenuList()
        {
            KClaim claim = new KClaim(1, (ClaimType)2, "Acident on I65", 500.50m, DateTime.Parse("03/14/2020"), DateTime.Parse("04/04/2020"), true)
            {
            };

            _kmenuRepo.AddClaimToDirectory(claim);
        }
Exemplo n.º 2
0
        public void addClaimToQue_ShouldReturnTrue()
        {
            KClaim    claim = new KClaim();
            kmenuRepo repo  = new kmenuRepo();

            bool addedResult = repo.AddClaimToDirectory(claim);

            Assert.IsTrue(addedResult);
        }
        public void NewClaim()
        {
            KClaim claim = new KClaim();              // instance of KClaim

            Console.WriteLine("Enter the caim id: "); //Getting ID
            claim.ClaimID = int.Parse(Console.ReadLine());

            Console.WriteLine("Select a claim type ex (1 = Car): \n" + //Getting Claim Type
                              "1) Car \n" +
                              "2) Home \n" +
                              "3) Theft ");
            string claimType    = Console.ReadLine();
            int    claimTypeNum = int.Parse(claimType);

            claim.TypeofClaim = (ClaimType)claimTypeNum;

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

            Console.WriteLine("Enter amount of damage: ");
            decimal dmg = Convert.ToDecimal(Console.ReadLine());

            claim.ClaimAmount = dmg;


            Console.Write("Enter date of accident (e.g. 03/06/1996): ");
            claim.DateOfIncident = DateTime.Parse(Console.ReadLine());

            Console.Write("Enter date of report (e.g. 03/06/1996): ");
            claim.DateOfClaim = DateTime.Parse(Console.ReadLine());
            TimeSpan timeSenseReport = claim.DateOfIncident - claim.DateOfClaim;

            if (timeSenseReport.TotalDays <= 30)
            {
                claim.IsValid = true;
            }
            else
            {
                claim.IsValid = false;
            }

            bool added = _kmenuRepo.AddClaimToDirectory(claim);

            if (added)
            {
                Console.WriteLine("Your claim has been added \n" +
                                  "Press any key to continue");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("There has been an error please try again.");
                Console.ReadKey();
            }
        }
Exemplo n.º 4
0
        public void getClaim_ShouldReturnTrue()
        {
            KClaim    claim = new KClaim();
            kmenuRepo repo  = new kmenuRepo();

            repo.AddClaimToDirectory(claim);

            Queue <KClaim> testQue  = repo.GetClaim();
            bool           addClaim = testQue.Contains(claim);

            Assert.IsTrue(addClaim);
        }
Exemplo n.º 5
0
 private void DisplaySimple(KClaim claim)
 {
     Console.WriteLine
         ($"Claim ID: {claim.ClaimID} \n" +
         $"Claim Type: {claim.TypeOfClaim} \n" +
         $"Claim Description: {claim.ClaimDesription} \n" +
         $"Claim Amount: {claim.ClaimAmount} \n" +
         $"Claim Incident Date: {claim.DateOfIncident} \n" +
         $"Claim Claim Date: {claim.DateOfClaim} \n" +
         $"Claim Is Valid: {claim.IsValid} \n" +
         $"------------------------------------------");
 }
Exemplo n.º 6
0
        public void NextClaim_ShouldReturnCorrectClaim()
        {
            KClaim    claim1 = new KClaim();
            KClaim    claim2 = new KClaim();
            kmenuRepo repo   = new kmenuRepo();

            repo.AddClaimToDirectory(claim1);
            repo.AddClaimToDirectory(claim2);

            KClaim testQue = repo.NextClaim();

            Assert.AreEqual(claim1, testQue);
        }
Exemplo n.º 7
0
        private void SeedClaims()
        {
            DateTime indicentDateOne   = new DateTime(2018, 04, 25);
            DateTime indicentDateTwo   = new DateTime(2018, 04, 11);
            DateTime indicentDateThree = new DateTime(2018, 04, 27);
            DateTime claimDateOne      = new DateTime(2018, 04, 27);
            DateTime claimDateTwo      = new DateTime(2018, 04, 12);
            DateTime claimDateThree    = new DateTime(2018, 06, 01);

            var claimOne   = new KClaim("1", ClaimType.Car, "Car accident on 465.", 400.00, indicentDateOne, claimDateOne, true);
            var claimTwo   = new KClaim("2", ClaimType.Home, "House fire in kitchen.", 4000.00, indicentDateTwo, claimDateTwo, true);
            var claimThree = new KClaim("3", ClaimType.Theft, "Stolen pancakes.", 4.00, indicentDateThree, claimDateThree, false);

            _claimRepo.AddClaimToDirectory(claimOne);
            _claimRepo.AddClaimToDirectory(claimTwo);
            _claimRepo.AddClaimToDirectory(claimThree);
        }
 public void DisplayMenu(KClaim claim)
 {
     Console.WriteLine("ClaimID \tType \t Description \t Amount \t DateOfAccident \t DateOfClaim \t \tIsValid\n" +
                       $"{claim.ClaimID} \t {claim.TypeofClaim} \t {claim.Description} \t {claim.ClaimAmount} \t {claim.DateOfIncident} \t {claim.DateOfClaim} \t {claim.IsValid}");
 }
Exemplo n.º 9
0
        private void EnterNewClaim()
        {
            KClaim claim = new KClaim();

            //Get user input
            Console.WriteLine("Please enter the claim ID: ");
            string claimID = Console.ReadLine();

            claim.ClaimID = claimID;
            Console.WriteLine("Select a claim type : \n" +
                              "1) Car \n" +
                              "2) Home \n" +
                              "3) Theft");
            string claimType = Console.ReadLine();

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

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

            case "3":
                claim.TypeOfClaim = ClaimType.Theft;
                break;
            }
            Console.WriteLine("Please enter the description of the claim:");
            string claimDescription = Console.ReadLine();

            claim.ClaimDesription = claimDescription;
            Console.WriteLine("Please enter the claim amount: ");
            claim.ClaimAmount = double.Parse(Console.ReadLine());

            DateTime incidentDate;

            Console.WriteLine("Enter date of incident in format MM/DD/YYYY: ");
            //accepts date in MM/dd/yyyy format
            incidentDate         = DateTime.Parse(Console.ReadLine());
            claim.DateOfIncident = incidentDate;
            DateTime claimDate;

            Console.WriteLine("Enter date of claim in format MM/DD/YYYY: ");
            //accepts date in MM/dd/yyyy format

            claimDate         = DateTime.Parse(Console.ReadLine());
            claim.DateOfClaim = claimDate;
            bool claimIsValid = true;

            //deal with isValid
            //System.TimeSpan diff = secondDate.Subtract(firstDate);
            //System.TimeSpan diff1 = secondDate - firstDate;
            /*TimeSpan*/
            double difference = (claimDate - incidentDate).TotalDays;

            if (difference > 30)
            {
                claimIsValid = false;
            }
            claim.IsValid = claimIsValid;

            _claimRepo.AddClaimToDirectory(claim);
        }