Ejemplo n.º 1
0
        private void EnterANewClaim()
        {
            Claim1 claim = new Claim1();

            Console.WriteLine("Please enter a claim identification.");
            claim.ClaimID = Console.ReadLine();

            Console.WriteLine("Please enter a claim type (enter a value between 1 and 3\n" +
                              "1. Car\n" +
                              "2. Home\n" +
                              "3. Theft");

            int claimType = Convert.ToInt32(Console.ReadLine());    //converting a string to an integer

            claim.ClaimType = (TypeOfClaim)claimType;               //"typecasting" to assign the index number of the Enum to the ClaimType property

            Console.WriteLine("Please enter a claim description.");
            claim.ClaimDescrip = Console.ReadLine();

            Console.WriteLine("Please enter a claim amount.");
            decimal amount = Convert.ToDecimal(Console.ReadLine());

            claim.SetPrice(amount);

            Console.WriteLine("Please enter the date of incident. Use format: YYYY,MM,DD");
            claim.DateOfIncident = Convert.ToDateTime(Console.ReadLine());

            Console.WriteLine("Please enter a date of claim. Use format: YYYY,MM,DD");
            claim.DateOfClaim = Convert.ToDateTime(Console.ReadLine());

            claim.IsValid = _claimRepo.ClaimIsValid(claim);

            _claimRepo.AddNewClaim(claim); //to "peek"/see upcoming claim
        }
Ejemplo n.º 2
0
        public void CreateANewClaim()
        {
            Claim1    claims     = new Claim1();
            ClaimRepo repository = new ClaimRepo();

            bool addResult = repository.ClaimIsValid(claims);

            Assert.IsTrue(addResult);
        }