public void AddClaimQueue_ShouldAddIt()
        {
            //Arrange
            Queue <Claim> localclaimsQueue = _repo.GetContents();
            //List<Claim> _contentClaims = new List<Claim>();
            DateTime inDateTime    = new DateTime(2020, 07, 01);
            DateTime claimDateTime = new DateTime(2020, 07, 04);
            Claim    _content1     = new Claim(10, ClaimType.Car, "Hit Bicycler", 30000.00, inDateTime, claimDateTime);
            //ACT
            int startingCount = localclaimsQueue.Count;

            _repo.AddClaimQueue(_content1);
            int  count    = localclaimsQueue.Count;
            bool wasAdded = (localclaimsQueue.Count > startingCount) ? true : false;

            // Assert
            Assert.IsTrue(wasAdded);
            //Assert!
        }
Пример #2
0
        private void EnterNewClaim()
        {
            Console.Clear();
            Claim content = new Claim();

            // claim id - integer that is used as lookup key
            Console.WriteLine("Enter the claim id (numeric): ");
            string claimNumber = Console.ReadLine();

            try
            {
                int result = Int32.Parse(claimNumber);
                content.ClaimId = result;
            }
            catch (FormatException)
            {
                // Output: Unable to parse ''
                Console.WriteLine($"Unable to parse '{claimNumber}' Put in a number!");
                Console.ReadKey();
            }
            // Claim Type is enum
            Console.WriteLine("Enter the claim type: \n" +
                              "1) Car \n" +
                              "2) Home \n" +
                              "3) Theft ");
            string typeString = Console.ReadLine();

            switch (typeString)
            {
            case "1":
                content.ClaimType = ClaimType.Car;
                break;

            case "2":
                content.ClaimType = ClaimType.Home;
                break;

            case "3":
                content.ClaimType = ClaimType.Theft;
                break;
            }
            // Description string
            Console.WriteLine("Enter the claim description: ");
            content.ClaimDescription = Console.ReadLine();
            // Amount - double
            Console.WriteLine("Enter amount of Damage (number with 2 decimal places): ");
            string amount = Console.ReadLine();

            content.ClaimAmount = Convert.ToDouble(amount);
            // Date of Incident - DateTime
            Console.WriteLine("Enter the date of Incident (MM/DD/YYYY): ");
            string dateOfIncident = Console.ReadLine();

            content.DateOfIncident = DateTime.Parse(dateOfIncident);
            // Date of Claim - DateTime
            Console.WriteLine("Enter the date of Claim (MM/DD/YYYY): ");
            string dateOfClaim = Console.ReadLine();

            content.DateOfClaim = DateTime.Parse(dateOfClaim);
            // Output: claim status
            if (content.IsValid == true)
            {
                Console.WriteLine("This claim is Valid \n" +
                                  "Press enter to continue");
                Console.ReadKey();
            }
            else
            {
                Console.WriteLine("This claim is NOT Valid \n" +
                                  "Press enter to continue");
                Console.ReadKey();
            }
            // call repository add claim method
            _repo.AddClaimQueue(content);
        }