示例#1
0
        public void AddNewClaim_ShouldGetCorrectBoolean()
        {
            Claims      claim = new Claims();
            ClaimsRepo2 repo  = new ClaimsRepo2();

            bool addClaim = repo.CreateNewClaim(claim);

            Assert.IsTrue(addClaim);
        }
示例#2
0
        private void AddNewClaim()
        {
            Console.Clear();
            Claims claim = new Claims();

            Console.WriteLine("Please enter new claim ID: ");
            claim.ClaimID = Convert.ToInt32(Console.ReadLine());

            Console.WriteLine("Please select claim type:\n" +
                              "Car = 1, Home = 2, Theft = 3");
            int typeAsInt = Convert.ToInt32(Console.ReadLine());

            claim.TypeOfClaim = (ClaimType)typeAsInt;

            Console.WriteLine("Please enter description of new claim: ");
            claim.Description = Console.ReadLine();

            Console.WriteLine("Please enter amount of new claim: ");
            claim.ClaimAmount = Convert.ToDecimal(Console.ReadLine());

            Console.WriteLine("Please enter date of incident for new claim with the following format: yyyy, mm, dd:");
            claim.DateOfIncident = Convert.ToDateTime(Console.ReadLine());

            Console.WriteLine("Please enter date of new claim with the following format: yyyy, mm, dd:");
            claim.DateOfClaim = Convert.ToDateTime(Console.ReadLine());

            TimeSpan isClaimValid = claim.DateOfClaim - claim.DateOfIncident;
            double   daysSince    = isClaimValid.TotalDays;

            if (daysSince <= 30)
            {
                claim.IsValid = true;
            }
            else
            {
                claim.IsValid = false;
            }
            //claim not successfully added
            _repo.CreateNewClaim(claim);
        }
示例#3
0
        public void GetClaims_ShouldReturnClaims()
        {
            Claims      claim = new Claims();
            ClaimsRepo2 repo  = new ClaimsRepo2();

            repo.CreateNewClaim(claim);

            Queue <Claims> directory = repo.GetClaims();

            bool directoryHasClaim = directory.Contains(claim);

            Assert.IsTrue(directoryHasClaim);
        }
示例#4
0
        public void PeekNext_ShouldReturnNextClaim()
        {
            Claims      claim = new Claims();
            ClaimsRepo2 repo  = new ClaimsRepo2();

            repo.CreateNewClaim(claim);

            Queue <Claims> newQueue = new Queue <Claims>();

            newQueue.Enqueue(repo.PeekNextClaim());
            bool hasClaim = newQueue.Contains(claim);

            Assert.IsTrue(hasClaim);
        }