public void AddToClaimMenu_ShouldGetCoorectBool()
        {
            //Arrange
            _02_Challenge.Claim content = new _02_Challenge.Claim();
            ClaimsRepository    repo    = new ClaimsRepository();

            //Act
            bool addResult = repo.AddClaimsToQueue(content);

            //Assert
            Assert.IsTrue(addResult);
        }
        public void DeleteMenuContent_ShouldDeleteSelectedContent()
        {
            //Arrange
            _02_Challenge.Claim content = new _02_Challenge.Claim(4, ClaimType.Car, "Turrible accident", 400.44, new DateTime(2018, 04, 11), new DateTime(2018, 04, 12));
            ClaimsRepository    repo    = new ClaimsRepository();

            repo.AddClaimsToQueue(content);

            //Act
            bool removeResult = repo.DeleteClaimItems();

            //Assert
            Assert.IsTrue(removeResult);
        }
        public void GetAllClaims_ShouldReturnAllClaims()
        {
            //Arrange
            _02_Challenge.Claim content = new _02_Challenge.Claim();
            ClaimsRepository    repo    = new ClaimsRepository();

            repo.AddClaimsToQueue(content);

            //Act
            Queue <_02_Challenge.Claim> claim = repo.GetAllClaimContent();
            bool thereIsSomethingHere         = claim.Contains(content);

            //Assert
            Assert.IsTrue(thereIsSomethingHere);
        }
Example #4
0
 public void AddClaimToQueue(Claim cName)
 {
     cName.ClaimID = _userID++;
     _seeQ.Enqueue(cName);
 }
Example #5
0
        private void AddAClaim()
        {
            Console.Clear();
            Claim newClaim = new Claim();

            Console.WriteLine("What type of claim is this?\n" +
                              "1. Car\n" +
                              "2. Home\n" +
                              "3. Theft\n");
            int typeClaim = int.Parse(Console.ReadLine());

            switch (typeClaim)
            {
            case 1:
                newClaim.ClaimType = ClaimType.Car;
                break;

            case 2:
                newClaim.ClaimType = ClaimType.Home;
                break;

            case 3:
                newClaim.ClaimType = ClaimType.Theft;
                break;
            }
            Console.WriteLine("What is the claim description?");
            newClaim.Description = Console.ReadLine();

            Console.WriteLine("What is the claim amount? Please use numerical values.");
            newClaim.Amount = decimal.Parse(Console.ReadLine());

            DateTime incidentDate = new DateTime();
            DateTime claimDate    = new DateTime();

Incident:
            Console.WriteLine("Write the date of the incident in MM/DD/YYYY format:");
            if (DateTime.TryParse(Console.ReadLine(), out incidentDate))
            {
                newClaim.DateOfIncident = incidentDate;
            }
            else
            {
                Console.WriteLine("There was a formatting error, please try again.");
                goto Incident;
            }

ClaimDate:
            Console.WriteLine("Write the date of the claim in MM/DD/YYYY format:");
            if (DateTime.TryParse(Console.ReadLine(), out claimDate))
            {
                newClaim.DateOfClaim = claimDate;
            }
            else
            {
                Console.WriteLine("There was a formatting error, please try again.");
                goto ClaimDate;
            }

            newClaim.IsValid = _repo.IsThisClaimValid(newClaim);

            _repo.AddClaimToQueue(newClaim);
        }