Beispiel #1
0
        public void AddClaimTest_ShouldGetCorrectBoolean()
        {
            Claims      claim = new Claims();
            Claims_Repo repo  = new Claims_Repo();

            bool addResult = repo.AddClaim(claim);

            Assert.IsTrue(addResult);
        }
Beispiel #2
0
        public void GetClaims_ShouldReturnCollectionOfClaims()
        {
            Claims      claim = new Claims();
            Claims_Repo repo  = new Claims_Repo();

            repo.AddClaim(claim);

            List <Claims> listClaims = repo.GetClaims();

            bool listHasClaims = listClaims.Contains(claim);

            Assert.IsTrue(listHasClaims);
        }
Beispiel #3
0
        private void CreateNewClaim()
        {
            Console.Clear();
            Claims        newClaim  = new Claims();
            List <Claims> allClaims = _repo.GetClaims();

            Console.WriteLine("Please enter an ID -number- for the claim.");
            int input = Convert.ToInt32(Console.ReadLine());

            foreach (Claims claim in allClaims)
            {
                if (input == claim.ClaimID)
                {
                    Console.WriteLine("This ID is already taken. Please choose a different ID");
                }
                else
                {
                    newClaim.ClaimID = input;
                }
            }

            Console.WriteLine("Enter the Type of Claim:\n" +
                              "1. Car\n" +
                              "2. Home\n" +
                              "3. Theft");
            newClaim.ClaimType = (ClaimType)Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Please describe the claim:");
            newClaim.Description = Console.ReadLine();

            Console.WriteLine("How much is the claim for?");
            newClaim.ClaimAmount = Convert.ToDouble(Console.ReadLine());

            Console.WriteLine("What was the date of the incident? (yyyy/mm/dd)");
            newClaim.DateOfIncident = DateTime.Parse(Console.ReadLine());

            newClaim.DateOfClaim = DateTime.Today;

            bool isadded = _repo.AddClaim(newClaim);

            if (isadded)
            {
                claimsQueue.Enqueue(newClaim);
                Console.WriteLine("Claim was successfully added");
            }
            else
            {
                Console.WriteLine("Error adding claim.");
            }
        }