Example #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
        }
Example #2
0
        //SEED helper
        private void SeedData()
        {
            var claim1 = new Claim("1", ClaimType.Auto, "Car accident on 465", 400.00, new DateTime(2018, 4, 25), new DateTime(2018, 4, 27), true);
            var claim2 = new Claim("2", ClaimType.Home, "House fire in kitchen", 4000.00, new DateTime(2018, 4, 11), new DateTime(2018, 4, 12), true);
            var claim3 = new Claim("3", ClaimType.Theft, "Stolen pancakes!", 4.00, new DateTime(2018, 4, 27), new DateTime(2018, 6, 1), false);

            _claimRepo.AddNewClaim(claim1);
            _claimRepo.AddNewClaim(claim2);
            _claimRepo.AddNewClaim(claim3);
        }
Example #3
0
        public void Arrange()
        {
            _repo = new ClaimRepo();

            Claim claim1 = new Claim(1, ClaimType.Car, "Car Accident On I-70", 399.99, DateTime.Today, DateTime.Today, false);
            Claim claim2 = new Claim(2, ClaimType.Home, "Big Fire no good", 950.99, DateTime.Today, DateTime.Today, true);
            Claim claim3 = new Claim(3, ClaimType.Theft, "Thief in the night", 500.00, DateTime.Today, DateTime.Today, false);

            _repo.AddNewClaim(claim1);
            _repo.AddNewClaim(claim2);
            _repo.AddNewClaim(claim3);
            Assert.AreEqual(_repo.GetClaimList().Count, 3);
        }
Example #4
0
        public void Arrange()
        {
            _claimRepo = new ClaimRepo();
            _claim     = new Claim("TestClaim");

            _claimRepo.AddNewClaim(_claim);
        }
        public void AddMealToMenuTest()
        {
            _claimRepo.AddNewClaim(_claim);
            int expected = 1;
            int actual   = _claimRepo.GetClaims().Count;

            Assert.AreEqual(expected, actual);
        }
Example #6
0
        //See Next Claim SHould Return Claim at Top of queue but shouldnt remove
        public void SeeNextClaim()
        {
            _repo = new ClaimRepo();

            Claim claim1 = new Claim(1, ClaimType.Car, "Car Accident On I-70", 399.99, DateTime.Today, DateTime.Today, false);
            Claim claim2 = new Claim(2, ClaimType.Home, "Big Fire no good", 950.99, DateTime.Today, DateTime.Today, true);
            Claim claim3 = new Claim(3, ClaimType.Theft, "Thief in the night", 500.00, DateTime.Today, DateTime.Today, false);

            _repo.AddNewClaim(claim1);
            _repo.AddNewClaim(claim2);
            _repo.AddNewClaim(claim3);
            Claim nextClaim = _repo.SeeNextClaim();

            //Next Claim id in queue should be 1
            Assert.AreEqual(nextClaim.ClaimID, 1);
            //Claim list should still contain 3 items.
            Assert.AreEqual(_repo.GetClaimList().Count, 3);
        }
Example #7
0
        public void ProcessNextClaim()
        {
            _repo = new ClaimRepo();

            Claim claim1 = new Claim(1, ClaimType.Car, "Car Accident On I-70", 399.99, DateTime.Today, DateTime.Today, false);
            Claim claim2 = new Claim(2, ClaimType.Home, "Big Fire no good", 950.99, DateTime.Today, DateTime.Today, true);
            Claim claim3 = new Claim(3, ClaimType.Theft, "Thief in the night", 500.00, DateTime.Today, DateTime.Today, false);

            _repo.AddNewClaim(claim1);
            _repo.AddNewClaim(claim2);
            _repo.AddNewClaim(claim3);

            //Claim list should still contain 3 items.
            Assert.AreEqual(_repo.GetClaimList().Count, 3);
            //Process next claim
            _repo.RemoveNextClaim();
            //Claim list should still contain 2 items.
            Assert.AreEqual(_repo.GetClaimList().Count, 2);
        }
        public void RetrieveClaim()
        {
            Claim1    claims     = new Claim1();
            ClaimRepo repository = new ClaimRepo();

            repository.AddNewClaim(claims);

            Queue <Claim1> claim = repository.RetrieveAllClaims();

            bool getClaim = claim.Contains(claims);

            Assert.IsTrue(getClaim);
        }
Example #9
0
        public void TestGetClaimByID()
        {
            //Arrange
            ClaimRepo claimRepo  = new ClaimRepo();
            Claim     claimToAdd = new Claim("TestClaimID");

            claimRepo.AddNewClaim(claimToAdd);
            //Act
            Claim claimByID = claimRepo.GetClaimByID
                                  (claimToAdd.ClaimID);

            //Assert
            Assert.AreEqual(claimToAdd, claimByID);
        }
Example #10
0
        public void AddClaim_ShouldGetNotNull()
        {
            ClaimRepo repo  = new ClaimRepo();
            Claim     claim = new Claim()
            {
                Amount         = 2.50m,
                Description    = "desc",
                ClaimID        = 1,
                Type           = Claim.ClaimType.Car,
                DateOfClaim    = DateTime.Now,
                DateOfIncident = DateTime.Today,
                IsValid        = true
            };

            repo.AddNewClaim(claim);
            Assert.IsNotNull(repo.GetClaims());
        }
Example #11
0
        private void AddNewClaim()
        {
            Claim claim = new Claim();

            Console.Write("ClaimID: ");
            claim.ClaimID = int.Parse(Console.ReadLine());

            Console.Write("1: Car" +
                          "\n2: Home" +
                          "\n3: Theft" +
                          "\nType of Claim: ");
            int userChoice = int.Parse(Console.ReadLine());

            claim.TypeOfClaim = (ClaimType)userChoice;

            Console.Write("Claim Description: ");
            claim.Desciption = Console.ReadLine();

            Console.Write("Claim Amount: ");
            claim.Amount = decimal.Parse(Console.ReadLine());

            Console.Write("Date of Accident: ");
            DateTime dateOfAccident;

            DateTime.TryParse(Console.ReadLine(), out dateOfAccident);
            claim.DateOfAccident = dateOfAccident;

            Console.Write("Date of Claim: ");
            DateTime dateOfClaim;

            DateTime.TryParse(Console.ReadLine(), out dateOfClaim);
            claim.DateOfClaim = dateOfClaim;

            TimeSpan validClaim = dateOfClaim.Subtract(dateOfAccident);

            if (validClaim.TotalDays < 30)
            {
                claim.IsValid = true;
            }
            else
            {
                claim.IsValid = false;
            }
            _claimRepo.AddNewClaim(claim);
        }
Example #12
0
        public void TestCreateMethod_ShouldReturnTrue()
        {
            //Arrange
            ClaimRepo claimRepo  = new ClaimRepo();
            Claim     claimToAdd = new Claim("TestClaim");

            //Act
            claimRepo.AddNewClaim(claimToAdd);

            //Assert
            Queue <Claim> claimDirectory = claimRepo.DisplayAllClaimsInQueue();

            bool IdIsEqual = false;

            foreach (Claim claim in claimDirectory)
            {
                if (claim.ClaimID == claimToAdd.ClaimID)
                {
                    IdIsEqual = true;
                    break;
                }
            }
            Assert.IsTrue(IdIsEqual);
        }
Example #13
0
        private void EnterNewClaim()
        {
            Console.Clear();
            Claim newItem = new Claim();

            Console.WriteLine("What Is the Claim ID of this claim:");
            string inputAsString = Console.ReadLine();

            newItem.ClaimID = int.Parse(inputAsString);


            Console.WriteLine("Enter the Type of Claim this is car, home or theft:");
            string typeInputAsString = Console.ReadLine();

            switch (typeInputAsString)
            {
            case "car":
                newItem.ClaimType = ClaimType.Car;
                break;

            case "home":
                newItem.ClaimType = ClaimType.Home;
                break;

            case "theft":
                newItem.ClaimType = ClaimType.Theft;
                break;

            default:
                Console.WriteLine("Please enter a valid claim type");
                break;
            }


            Console.WriteLine("Enter the description of the new claim:");
            newItem.Desc = Console.ReadLine();



            Console.WriteLine("Enter the Amount of the New Claim");
            string priceAsString = Console.ReadLine();

            newItem.ClaimAmount = double.Parse(priceAsString);



            Console.WriteLine("What month did this accident happen in?:");
            int accidentMonth = int.Parse(Console.ReadLine());

            Console.WriteLine("What day of the month did this accident happen on?:");
            int accidentDay = int.Parse(Console.ReadLine());

            Console.WriteLine("What year did this accident happen in?:");
            int accidentYear = int.Parse(Console.ReadLine());

            newItem.IncidentDate = new DateTime(accidentYear, accidentMonth, accidentDay);

            Console.WriteLine("What month did this claim happen in?:");
            int claimMonth = int.Parse(Console.ReadLine());

            Console.WriteLine("What day of the month did this claim happen on?:");
            int claimDay = int.Parse(Console.ReadLine());

            Console.WriteLine("What year did this claim happen in?:");
            int claimYear = int.Parse(Console.ReadLine());

            newItem.IncidentDate = new DateTime(claimYear, claimMonth, claimDay);

            Console.WriteLine("Is this a Valid Claim? (Y/N)");
            string validClaim = Console.ReadLine();

            if (validClaim == "Y")
            {
                newItem.IsValid = true;
            }
            else
            {
                newItem.IsValid = false;
            }

            _claimRepo.AddNewClaim(newItem);
        }