Ejemplo n.º 1
0
        private void CreateAClaim()
        {
            Console.Clear();
            ClaimContents newClaim = new ClaimContents();

            Console.WriteLine("Please enter the Claim ID number:");
            string newIDNum = Console.ReadLine();

            newClaim.ClaimID = int.Parse(newIDNum);

            Console.WriteLine("Which type of claim is this?\n" +
                              "1) Car\n" +
                              "2) Home\n" +
                              "3) Theft");

            string claimTypeString = Console.ReadLine();
            int    typeAsString    = int.Parse(claimTypeString);

            newClaim.TypeOfClaim = (ClaimType)typeAsString;

            Console.WriteLine("Please enter a brief description:");
            newClaim.ClaimDescription = Console.ReadLine();

            Console.WriteLine("What is the amount of damage?");
            string costAsString = Console.ReadLine();

            newClaim.ClaimAmount = double.Parse(costAsString);

            Console.WriteLine("On what date did the accident occur? etc: (5/11/2018)");
            string doaAsString = Console.ReadLine();

            newClaim.DateOfIncident = DateTime.Parse(doaAsString);

            Console.WriteLine("When was the claim recieved? ex: (5/20/2018)");
            string docAsString = Console.ReadLine();

            newClaim.DateOfClaim = DateTime.Parse(docAsString);

            Console.WriteLine("Was this a valid claim? (Yes or No)");
            string isValidClaim = Console.ReadLine().ToLower();

            if (isValidClaim == "yes")
            {
                newClaim.IsValid = true;
            }
            else
            {
                newClaim.IsValid = false;
            }

            _claimContentRepo.AddClaimToQue(newClaim);
        }
        public void DeleteClaim_True()
        {
            ClaimContentRepo cRepo  = new ClaimContentRepo();
            ClaimContents    cClaim = new ClaimContents(7, ClaimType.Car, "Car accident on 37.", 100.00, new DateTime(2018, 06, 20), new DateTime(2018, 6, 28), true);

            cRepo.AddClaimToQue(cClaim);

            bool deletedTest = cRepo.DeleteClaim(cClaim.ClaimID);

            Assert.IsTrue(deletedTest);
        }
        public void TestGetByClaimID()
        {
            ClaimContentRepo cRepo  = new ClaimContentRepo();
            ClaimContents    cClaim = new ClaimContents(7, ClaimType.Car, "Car accident on 37.", 100.00, new DateTime(2018, 06, 20), new DateTime(2018, 6, 28), true);

            cRepo.AddClaimToQue(cClaim);

            ClaimContents claimByID = cRepo.GetClaimByClaimID(cClaim.ClaimID);

            bool idNumsEq = cClaim.ClaimID == claimByID.ClaimID;

            Assert.IsTrue(idNumsEq);
        }
        public void AddToClaimQ_ShouldGetNotNull()
        {
            ClaimContentRepo cRepo  = new ClaimContentRepo();
            ClaimContents    cClaim = new ClaimContents(7, ClaimType.Car, "Car accident on 37.", 100.00, new DateTime(2018, 06, 20), new DateTime(2018, 6, 28), true);

            cRepo.AddClaimToQue(cClaim);

            Queue <ClaimContents> listOfClaimsQ = cRepo.GetListOfClaims();

            bool claimNumEq = false;

            foreach (ClaimContents claims in listOfClaimsQ)
            {
                if (claims.ClaimID == cClaim.ClaimID)
                {
                    claimNumEq = true;
                    break;
                }
            }
            Assert.IsTrue(claimNumEq);
        }