public void SeedClaims()
        {
            Claim claim1 = new Claim(
                1,
                ClaimType.Car,
                "Car accident on 465",
                400.00,
                new DateTime(2018, 4, 25),
                new DateTime(2018, 4, 27));
            Claim claim2 = new Claim(
                02,
                ClaimType.Home,
                "House fire in kitchen",
                4000.00,
                new DateTime(2018, 4, 11),
                new DateTime(2018, 4, 12));
            Claim claim3 = new Claim(
                03,
                ClaimType.Theft,
                "Stolen pancakes",
                4.00,
                new DateTime(2018, 4, 27),
                new DateTime(2018, 6, 18));

            _repo.AddClaim(claim1);
            _repo.AddClaim(claim2);
            _repo.AddClaim(claim3);
        }
示例#2
0
        private void AddClaimToList()
        {
            Console.Clear();
            Claim addClaim = new Claim();

            Console.Write("Enter the claim id: ");
            addClaim.ID = Convert.ToInt32(Console.ReadLine());
            Console.Write("Enter the claim type (1-Car, 2-Home, 3-Theft): # ");
            string typeClaim = Console.ReadLine();
            int    typeID    = int.Parse(typeClaim);

            addClaim.TypeOfClaim = (ClaimType)typeID;
            Console.Write("Enter a claim description: ");
            addClaim.Description = Console.ReadLine();
            Console.Write("Amount of damage: $ ");
            addClaim.Amount = Convert.ToDouble(Console.ReadLine());
            Console.Write("Date of accident (ex - yyyy, mm, dd): ");
            addClaim.DateOfIncident = DateTime.Parse(Console.ReadLine());
            Console.Write("Date of claim (ex - yyyy, mm, dd): ");
            addClaim.DateOfClaim = DateTime.Parse(Console.ReadLine());
            if (addClaim.IsValid)
            {
                Console.Write($"This claim is valid\n");
                Console.WriteLine("\n" +
                                  "Claim added to queue\n" +
                                  "\n" +
                                  "Press any key to continue");
                Console.ReadKey();
            }
            else
            {
                Console.ReadKey();
            }
            _repo.AddClaim(addClaim);
        }
        public void AddToList_Test()
        {
            //ARRANGE
            Claim      newOne = new Claim();
            Claim_Repo repo   = new Claim_Repo();
            //ACT
            bool addClaim = repo.AddClaim(newOne);

            //ASSERT
            Assert.IsTrue(addClaim);
        }
        public void AddClaim_ShouldGetCorrectBool() //Create
        {
            //Arrange
            Claim      claim = new Claim();
            Claim_Repo repo  = new Claim_Repo();

            //Act
            bool addClaim = repo.AddClaim(claim);

            //Assert
            Assert.IsTrue(addClaim);
        }
        public void GetListOfCLaims_Test()
        {
            //Arrange
            Claim      newOne = new Claim();
            Claim_Repo repo   = new Claim_Repo();

            repo.AddClaim(newOne);
            //ACT
            Queue <Claim> newList  = repo.GetListOfClaims();
            bool          hasClaim = newList.Contains(newOne);

            //ASSERT
            Assert.IsTrue(hasClaim);
        }
        public void DequeueClaim_ShouldReturnTrue()
        {
            //Arrange
            Claim      claim = new Claim();
            Claim_Repo repo  = new Claim_Repo();

            repo.AddClaim(claim);

            //Act
            bool dequeuedClaim = repo.DequeueClaim();

            //Assert
            Assert.IsTrue(dequeuedClaim);
        }
        public void PeekClaim_ShouldReturnNextClaim() //Read
        {
            //Arrange
            Claim      claim = new Claim();
            Claim_Repo repo  = new Claim_Repo();

            repo.AddClaim(claim);

            //Act
            Claim nextClaim = repo.PeekClaim();

            //Assert
            Assert.AreEqual(nextClaim, claim);
        }
        public void GetClaims_ShouldReturnCorrectCollection() //Read
        {
            //Arrange
            Claim      claim = new Claim();
            Claim_Repo repo  = new Claim_Repo();

            repo.AddClaim(claim);

            //Act
            Queue <Claim> claims   = repo.GetAllClaims();
            bool          hasClaim = claims.Contains(claim);

            //Assert
            Assert.IsTrue(hasClaim);
        }