Exemple #1
0
        public void GetNextContentTest()
        {
            KomodoClaimsRepository queueRepo = new KomodoClaimsRepository();
            KomodoClaims           content   = new KomodoClaims(1, ClaimType.Home, "Bad stuff happened", 400.34m, new DateTime(1989, 05, 19), new DateTime(1989, 5, 23), true);
            KomodoClaims           content2  = new KomodoClaims(2, ClaimType.Car, "Big Boom", 400.34m, new DateTime(2018, 05, 19), new DateTime(2018, 9, 23), false);

            queueRepo.AddToQueue(content);
            queueRepo.AddToQueue(content2);
            queueRepo.GetNextContent();
            Queue <KomodoClaims> list = queueRepo.GetAllQueue();

            var expected = 1;
            var actual   = list.Count;

            Assert.AreEqual(expected, actual);
        }
Exemple #2
0
        public void PeekNextContentTest()
        {
            KomodoClaimsRepository queueRepo = new KomodoClaimsRepository();
            KomodoClaims           content   = new KomodoClaims(1, ClaimType.Home, "Bad stuff happened", 400.34m, new DateTime(1989, 05, 19), new DateTime(1989, 5, 23), true);

            queueRepo.AddToQueue(content);
            KomodoClaims queueContent = queueRepo.PeekNextContent();

            Assert.AreSame(content, queueContent);
        }
Exemple #3
0
        private void AddNewClaim()
        {
            Console.WriteLine("What is the claim ID?");
            int claimID = int.Parse(Console.ReadLine());

            Console.WriteLine("What is claim type number?\n" +
                              "1: Car\n" +
                              "2: Home\n" +
                              "3: Theft");
            int       claim     = int.Parse(Console.ReadLine());
            ClaimType claimType = (ClaimType)claim;

            Console.WriteLine("Input description of claim.");
            string description = Console.ReadLine();

            Console.WriteLine("What is claim monitary amount in decimal format.");
            decimal claimAmount = decimal.Parse(Console.ReadLine());

            Console.WriteLine("What was the date of the incident? (YYYY/MM/DD)");
            DateTime incidentDateTime = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("What was the date of the claim? (YYYY/MM/DD)");
            DateTime claimDateTime = DateTime.Parse(Console.ReadLine());

            Console.WriteLine("Is this a valid claim? (Y/N)");
            string validAsString = Console.ReadLine().ToLower();
            bool   isValid       = false;

            switch (validAsString)
            {
            case "y":
            case "yes":
                isValid = true;
                break;

            case "n":
            case "no":
                isValid = false;
                break;
            }
            KomodoClaims newContent = new KomodoClaims(claimID, claimType, description, claimAmount, incidentDateTime, claimDateTime, isValid);

            _claimRepo.AddToQueue(newContent);
        }