コード例 #1
0
        public void AddClaimShouldReturnCorrectBoolean()
        {
            Claims      newClaims  = new Claims();
            Claims_Repo repository = new Claims_Repo();

            bool wasAdded = repository.AddClaimsToQueue(newClaims);

            Assert.IsTrue(wasAdded);
        }
コード例 #2
0
        private void AddNewClaim()
        {
            Console.Clear();

            Claims newClaim = new Claims();

            Console.WriteLine("Please enter a ClaimID.");
            string idAsAString = Console.ReadLine();
            int    idAsAInt    = int.Parse(idAsAString);

            newClaim.ClaimID = idAsAInt;

            Console.WriteLine("Please enter a claim type. (Car, Home, Theft, etc)");
            newClaim.ClaimType = Console.ReadLine();

            Console.WriteLine("Please enter a description of the incident.");
            newClaim.Description = Console.ReadLine();

            Console.WriteLine("Please enter the claim amount. (400, 250, 1000, etc)");
            string amountAsString = Console.ReadLine();
            double amountAsDouble = double.Parse(amountAsString);

            newClaim.ClaimAmount = amountAsDouble;

            Console.WriteLine("Please enter the date of the incident. (Jan 1, 2020)");
            string dateIncidentAsString = Console.ReadLine();
            var    parsedIncidentDate   = DateTime.Parse(dateIncidentAsString);

            newClaim.DateOfIncident = parsedIncidentDate;

            Console.WriteLine("Please enter the date of the claim. (Jan 1, 2020)");
            string dateClaimAsString = Console.ReadLine();
            var    parsedClaimDate   = DateTime.Parse(dateClaimAsString);

            newClaim.DateOfClaim = parsedClaimDate;

            bool wasAdded = _repo.AddClaimsToQueue(newClaim);

            if (wasAdded == true)
            {
                Console.WriteLine("Your claim was successfully added.");
            }
            else
            {
                Console.WriteLine("Unable to add claim.");
            }

            Console.ReadLine();
        }