Пример #1
0
        private void EnterNewClaim()
        {
            Console.Clear();

            ClaimsProp newClaim = new ClaimsProp();

            Console.WriteLine("Please enter the claim description. ");
            newClaim.Description = Console.ReadLine();

            Console.WriteLine("Please enter the claim type number:\n" +
                              "1. Car\n" +
                              "2. Home\n" +
                              "3. Theft\n");
            string claimAsString = Console.ReadLine();
            int    claimAsInt    = int.Parse(claimAsString);

            newClaim.TypeOfClaim = (ClaimType)claimAsInt;
            //must cast () for claimtype to populate

            Console.WriteLine("Please enter the claim amount. ");
            string dubAsString = Console.ReadLine();

            newClaim.ClaimAmount = decimal.Parse(dubAsString);

            Console.WriteLine("Please enter date of accident.\n " +
                              "Format: year/month/day");
            string   dateAsString = Console.ReadLine();
            DateTime incidentDate = DateTime.Parse(dateAsString);

            newClaim.DateOfIncident = incidentDate;

            Console.WriteLine("Please enter the date of the claim.\n" +
                              "Format: year/month/day");
            string   dateString = Console.ReadLine();
            DateTime claimDate  = DateTime.Parse(dateString);

            newClaim.DateOfClaim = claimDate;

            TimeSpan result = claimDate.Subtract(incidentDate);// best way to subtract after testing multiple techniques

            if (result.Days <= 30 && result.Days >= 1)
            {
                Console.WriteLine("This claim is valid");
                newClaim.IsValid = true;
            }
            else
            {
                Console.WriteLine("This claim is not valid");
                newClaim.IsValid = false;
            }

            _claimsRepo.AddToClaimsQueue(newClaim);
        }
Пример #2
0
        public void Arrange()
        {
            _repo    = new ClaimsRepo();
            _content = new ClaimsProp(1, "car collision", 400.00m, new DateTime(2019 / 4 / 18), new DateTime(2019 / 4 / 20), true, ClaimType.Car);

            _repo.AddToClaimsQueue(_content);
        }
Пример #3
0
        public void AddToClaimsQueue_ShouldNotGetNull()
        {
            //arrange
            ClaimsProp content = new ClaimsProp();

            content.ClaimID = 1;
            ClaimsRepo repository = new ClaimsRepo();

            //act
            repository.AddToClaimsQueue(content);
            ClaimsProp contentFromRepo = repository.GetClaimById(1);

            //Assert
            Assert.IsNotNull(contentFromRepo);
        }