Ejemplo n.º 1
0
        public void AddClaimTest()
        {
            _repo.AddClaim(_claims);
            int expected = 1;
            int actual   = _repo.GetList().Count;

            Assert.AreEqual(actual, expected);
        }
        private void SeedClaimsList()
        {
            Claim firstClaim  = new Claim(1, ClaimType.car, "Car accident on 465", 400.00m, new DateTime(2018, 4, 25), new DateTime(2018, 4, 27), true);
            Claim secondClaim = new Claim(2, ClaimType.home, "House fire in kitchen.", 4000.00m, new DateTime(2018, 4, 11), new DateTime(2018, 4, 12), true);
            Claim thirdClaim  = new Claim(3, ClaimType.theft, "Stolen pancakes.", 4.00m, new DateTime(2018, 4, 27), new DateTime(2018, 6, 1), false);

            _repo.AddClaim(firstClaim);
            _repo.AddClaim(secondClaim);
            _repo.AddClaim(thirdClaim);
        }
Ejemplo n.º 3
0
        public void AddTest()
        {
            Claim claim = new Claim(
                1, ClaimType.car, "test", 400m, new DateTime(2018, 4, 13), new DateTime(2017, 3, 4), false);

            _repo.AddClaim(claim);

            Console.WriteLine(claim.ClaimType);
            Console.WriteLine(_repo.GetClaims().Count);
        }
Ejemplo n.º 4
0
        //SeedClaimList
        private void SeedClaimList()
        {
            //public Claims(int claimId, string claimType, string description, double claimAmount, DateTime dateOfAccident, DateTime dateOfClaim, bool isValid, TypesOfClaims claim)

            Claims car   = new Claims(1, "Car", "Car accident on 465", 400.00, new DateTime(2020, 5, 18), new DateTime(2020, 7, 18), true, TypesOfClaims.Car);
            Claims home  = new Claims(2, "Home", "House fire in kitchen", 400.00, new DateTime(2020, 11, 18), new DateTime(2020, 12, 18), true, TypesOfClaims.Home);
            Claims theft = new Claims(3, "Theft", "Stoken pancakes", 4.00, new DateTime(2020, 7, 18), new DateTime(2020, 01, 18), false, TypesOfClaims.Theft);

            _claimsRepo.AddClaim(car);
            _claimsRepo.AddClaim(home);
            _claimsRepo.AddClaim(theft);
        }
        public void Arrange()
        {
            _repo    = new ClaimsRepo();
            _content = new Claim(515, ClaimType.Car, "Fender Bender", 1000.00m, new DateTime(2020, 12, 1), new DateTime(2020, 12, 20), true);

            _repo.AddClaim(_content);
        }
Ejemplo n.º 6
0
        public void AddNewClaim()
        {
            ClaimsPoco claims = new ClaimsPoco();

            Console.WriteLine("Enter Claim ID number");
            claims.ClaimID = int.Parse(Console.ReadLine());

            Console.WriteLine("Enter Claim description ");
            claims.Description = Console.ReadLine();

            Console.WriteLine("Enter Claim Amount");
            claims.ClaimAmount = double.Parse(Console.ReadLine());

            Console.WriteLine("Enter date of incident");
            claims.DateOfIncident = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("Enter date of claim");
            claims.DateOfClaim = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("Is claim Valid? (true/false)");
            claims.IsValid = bool.Parse(Console.ReadLine());

            Console.WriteLine("Enter the Number assosiated to the claim type:\n" +
                              "1. Car\n" +
                              "2. Home\n" +
                              "3. Theft");
            int TypeNum = int.Parse(Console.ReadLine());

            claims.TypeOfClaim = (ClaimType)TypeNum;
            _claimUIRepo.AddClaim(claims);
        }
Ejemplo n.º 7
0
 public void TestClaim()
 {
     _claims = new Claims(1, "Car", "Car accident on 465", 400.00,
                          new DateTime(2020, 5, 18),
                          new DateTime(2020, 7, 18), true, TypesOfClaims.Car);
     _claimRepo = new ClaimsRepo();
     _claimRepo.AddClaim(_claims);
 }
        public void SeedTestMethod()
        {
            _repo  = new ClaimsRepo();
            _claim = new Claims(1, ClaimType.Car, "Car accident on 465", 400, new DateTime(2018, 04, 25), new DateTime(2018, 04, 27));


            _repo.AddClaim(_claim);
        }
        public void CreatClaimTestShouldWork()
        {
            Claims     claim = new Claims();
            ClaimsRepo repo  = new ClaimsRepo();

            bool add = repo.AddClaim(claim);

            Assert.IsTrue(add);
        }
        public void DeleteClaim()
        {
            bool deleted = _repo.DeleteClaimByID(2);

            Assert.IsTrue(deleted);

            _repo.AddClaim(_claim);

            bool deQueued = _repo.DequeueClaims();

            Assert.IsTrue(deQueued);
        }
        public void ReadClaims()
        {
            Claims     claim = new Claims();
            ClaimsRepo repo  = new ClaimsRepo();

            repo.AddClaim(claim);

            Queue <Claims> queue    = repo.GetClaims();
            bool           newQueue = queue.Contains(claim);

            Assert.IsTrue(newQueue);
        }
Ejemplo n.º 12
0
        public void TestForAddingClaim()
        {
            //Arrange
            Claims     claim      = new Claims();
            ClaimsRepo claimsRepo = new ClaimsRepo();

            //Act
            claimsRepo.AddClaim(claim);
            Claims claimFromClaimsID = claimsRepo.GetCalimByClaimID(claim.ClaimID);

            //claim

            //Assert
            Assert.IsNotNull(claimFromClaimsID);
        }
Ejemplo n.º 13
0
        public void GetClaimById()
        {
            //Arange
            ClaimsRepo claimsRepo  = new ClaimsRepo();
            Claims     claimsToAdd = new Claims(1, "Car", "Car accident on 465", 400.00,
                                                new DateTime(2020, 5, 18),
                                                new DateTime(2020, 7, 18), true, TypesOfClaims.Car);

            _claimRepo = new ClaimsRepo();
            _claimRepo.AddClaim(claimsToAdd);



            //Act
            Claims claimByID    = claimsRepo.GetCalimByClaimID(claimsToAdd.ClaimID);
            bool   isClaimEqual = claimsToAdd.ClaimID == claimsToAdd.ClaimID;

            //Assert
            Assert.IsTrue(isClaimEqual);
        }
Ejemplo n.º 14
0
        private void NewClaim()
        {
            Console.Clear();
            Claims newClaim = new Claims();

            Console.Write("\n\t Enter Claim ID#: ");
            newClaim.ClaimID = Convert.ToInt32(Console.ReadLine());
            Console.Clear();

            Console.Write("\n\t What is the Claim Type?\n" +
                          "\t1. Car\n" +
                          "\t2. Home\n" +
                          "\t3. Theft\n" +
                          "\n\t");
            string input = Console.ReadLine();

            switch (input.ToLower())
            {
            case "1":
            case "one":
            case "car":

                newClaim.Type = ClaimType.Car;
                break;

            case "2":
            case "two":
            case "home":
                newClaim.Type = ClaimType.Home;
                break;

            case "3":
            case "three":
            case "theft":
                newClaim.Type = ClaimType.Theft;
                break;

            default:
                Console.WriteLine("\t\n That is not an available option");
                Console.ReadKey();
                NewClaim();
                break;
            }
            Console.Clear();

            Console.Write("\n\t Enter Claim Description:\n" +
                          "\n\t");
            newClaim.Description = Console.ReadLine();
            Console.Clear();

            Console.Write("\n\t Eneter Cost of Damage: \n" +
                          "\n\t $");
            newClaim.Amount = Convert.ToDouble(Console.ReadLine());
            Console.Clear();

            Console.Write("\n\t Enter Date of Accident:\n" +
                          "\tExample: mm dd yyyy or January 1 2021\n" +
                          "\n\t");
            DateTime accidnetDate;

            if (DateTime.TryParse(Console.ReadLine(), out accidnetDate))
            {
                newClaim.DateOfAccident = accidnetDate;
            }
            else
            {
                Console.WriteLine("\n\t That format can not be recognized");
                Console.ReadKey();
                NewClaim();
            }

            Console.Write("\n\t Enter Date of Claim:\n" +
                          "\tExample: mm dd yyyy or January 1 2021\n" +
                          "\n\t");
            DateTime claimDate;

            if (DateTime.TryParse(Console.ReadLine(), out claimDate))
            {
                newClaim.DateOfClaim = claimDate;
            }
            else
            {
                Console.WriteLine("\n\t That format can not be recognized");
                Console.ReadKey();
                NewClaim();
            }
            Console.Clear();


            bool wasAdded = _repo.AddClaim(newClaim);

            if (wasAdded)
            {
                Console.WriteLine("\n\t Claim has been added");
            }
            else
            {
                Console.WriteLine("\n\t Claim could not be added");
            }
        }
        public void EnterNewClaim()
        {
            ClaimsType content = new ClaimsType();

            Console.Clear();
            Console.WriteLine("ClaimID	Type	Description  Amount	  DateOfIncident 	DateOfClaim	  IsValid\n");

            Console.WriteLine("Please enter the new claim ID: ");
            content.ClaimId = int.Parse(Console.ReadLine());

            Console.WriteLine($"({content.ClaimId}) (Type) (Description) (Amount) (Incident Date) (Claim Date) (Valid)\n");

            Console.WriteLine("Please enter the claim type: \n" +
                              "1. Car\n" +
                              "2. House\n" +
                              "3. Theft\n");

            string answer = Console.ReadLine().ToLower();

            switch (answer)
            {
            case "1":
                content.ClaimType = ClaimsType.TypeOfClaim.Car;
                break;

            case "2":
                content.ClaimType = ClaimsType.TypeOfClaim.House;
                break;

            case "3":
                content.ClaimType = ClaimsType.TypeOfClaim.Theft;
                break;
            }

            Console.Clear();
            Console.WriteLine($"({content.ClaimId}) ({content.ClaimType}) (Description) (Amount) (Incident Date) (Claim Date) (Valid)\n");

            Console.WriteLine("Please enter a description for the claim: ");
            content.Description = Console.ReadLine().ToLower();

            Console.Clear();
            Console.WriteLine($"({content.ClaimId}) ({content.ClaimType}) ({content.Description}) (Amount) (Incident Date) (Claim Date) (Valid)\n");

            Console.WriteLine("Please enter the claim amount: ");
            content.ClaimAmount = decimal.Parse(Console.ReadLine());

            Console.Clear();
            Console.WriteLine($"({content.ClaimId}) ({content.ClaimType}) ({content.Description}) (${content.ClaimAmount}) (Incident Date) (Claim Date) (Valid)\n");

            Console.WriteLine("Please enter the date of the incident: ");
            content.DateOfIncident = DateTime.Parse(Console.ReadLine());

            Console.Clear();
            Console.WriteLine($"({content.ClaimId}) ({content.ClaimType}) ({content.Description}) (${content.ClaimAmount}) ({content.DateOfIncident}) (Claim Date) (Valid)\n");

            Console.WriteLine("Please enter the date the claim was made: ");
            content.DateOfClaim = DateTime.Parse(Console.ReadLine());

            Console.Clear();
            Console.WriteLine($"({content.ClaimId}) ({content.ClaimType}) ({content.Description}) (${content.ClaimAmount}) ({content.DateOfIncident}) ({content.DateOfClaim}) (Valid)\n");

            Console.WriteLine("Please enter whether or not this is a valid claim: ");
            content.IsValid = bool.Parse(Console.ReadLine());

            Console.Clear();
            Console.WriteLine($"({content.ClaimId}) ({content.ClaimType}) ({content.Description}) (${content.ClaimAmount}) ({content.DateOfIncident}) ({content.DateOfClaim}) ({content.IsValid})\n");

            _repo.IsValid(content);

            Console.Clear();
            Console.WriteLine($"The following claim will be added to the queue: \n" +
                              $"\n" +
                              $"Id: {content.ClaimId}/n" +
                              $"Type: {content.ClaimType}\n" +
                              $"Description: {content.Description}\n" +
                              $"Amount: {content.ClaimAmount}\n" +
                              $"Incident Date: {content.DateOfIncident}\n" +
                              $"Claim Date: {content.DateOfClaim}\n" +
                              $"Valid: {content.IsValid}\n" +
                              $"\n" +
                              $"\n" +
                              $"Please press any key to confirm adding new claim");
            Console.ReadKey();

            _repo.AddClaim(content);

            Console.Clear();
            Console.WriteLine("This claim was successfully added to the queue! Update successful.\n" +
                              "Press any key to return to the main menu");
            Console.ReadKey();
        }