Esempio n. 1
0
        public void UpdateExistingContent_ShouldReturnTrue()
        {
            ClaimContent newContent = new ClaimContent(7, "car", "fender bender", new DateTime(1997 - 5 - 30), new DateTime(1997 - 6 - 10), 560.56, true);

            bool updateResult = _repo.UpdateExistingContent(1, newContent);

            Assert.IsTrue(updateResult);
        }
Esempio n. 2
0
        private void UpdateExistingContent()
        {
            DisplayAllContent();

            Console.WriteLine("enter the claim you would like to update");
            int oldContent = int.Parse(Console.ReadLine());

            ClaimContent newContent = new ClaimContent();

            Console.WriteLine("enter the claim you would like to open");
            string claimNumberAsString = Console.ReadLine();

            newContent.ClaimId = int.Parse(claimNumberAsString);

            Console.WriteLine("Enter the claim type (Vehicle)");
            newContent.ClaimType = Console.ReadLine();

            Console.WriteLine("Enter what happened.");
            newContent.Description = Console.ReadLine();

            Console.WriteLine("what was the date of this incident (yyyy/mm/dd)");
            string dateOfIncidentAsString = Console.ReadLine();

            newContent.DateOfIncident = DateTime.Parse(dateOfIncidentAsString);

            Console.WriteLine("What was the date of the claim (yyyy/mm/dd)");
            string dateOfClaimAsString = Console.ReadLine();

            newContent.DateOfClaim = DateTime.Parse(dateOfClaimAsString);

            Console.WriteLine("How much does the claim cost");
            string claimAmountAsString = Console.ReadLine();

            newContent.ClaimAmount = double.Parse(claimAmountAsString);



            Console.WriteLine("Is this claim valid");
            string validAsString = Console.ReadLine();

            if (validAsString == "y")
            {
                newContent.Valid = true;
            }
            else if (validAsString == "n")
            {
                newContent.Valid = false;
            }
            else
            {
                Console.WriteLine("Enter either y/n...");
            }

            bool wasUpdated = _contentRepo.UpdateExistingContent(oldContent, newContent);

            if (wasUpdated)
            {
                Console.WriteLine("content successfully updated.");
            }
            else
            {
                Console.WriteLine("could not update");
            }
        }