Exemple #1
0
        public void CanAddValidClaimToPolicyThatHasBeenClosedForLessThanSixMonths()
        {
            var policy = new Policy
            {
                ContactInfo = "Test Name",
                Closed = DateTime.Today.AddMonths(-5),
                Description = "Test Description",
                HolderName = "Test Holder",
                InsuredAmount = 1000M,
                PaidToDate = 500M,
                PolicyType = Coverage.Extended,
                Premium = 30M,
                StartDate = DateTime.Today.AddYears(-1)
            };

            var claim = new Claim
            {
                Amount = 100M,
                Issued = DateTime.Today,
                Narrative = "test narrative",
                Paid = null,
                Policy = policy
            };

            var validations = claim.Validate();

            Assert.IsTrue(validations.Count == 0);
        }
Exemple #2
0
        public List<string> AcceptClaim(Claim claim)
        {
            var errors = claim.Validate();

            if (!errors.Any())
            {
                claimsRepository.AddClaim(claim);
                return null;
            }

            return errors;
        }
Exemple #3
0
        public void CannotAddValidClaimToPolicyWithoutPolicyReference()
        {
            var policy = new Policy
            {
                ContactInfo = "Test Name",
                Closed = null,
                Description = "Test Description",
                HolderName = "Test Holder",
                InsuredAmount = 1000M,
                PaidToDate = 500M,
                PolicyType = Coverage.Extended,
                Premium = 30M,
                StartDate = DateTime.Today.AddYears(-1)
            };

            var claim = new Claim
            {
                Amount = 100M,
                Issued = DateTime.Today,
                Narrative = "test narrative",
                Paid = null,
                Policy = null
            };

            var validations = claim.Validate();

            Assert.IsTrue(validations.Count == 1);
        }