コード例 #1
0
ファイル: DomainTests.cs プロジェクト: malcolmmacleod/FOA
        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);
        }
コード例 #2
0
ファイル: ClaimsService.cs プロジェクト: malcolmmacleod/FOA
        public List<string> AcceptClaim(Claim claim)
        {
            var errors = claim.Validate();

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

            return errors;
        }
コード例 #3
0
ファイル: DomainTests.cs プロジェクト: malcolmmacleod/FOA
        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);
        }