public async Task Validate_ShouldReturnCorrectResults(double operationAmount)
        {
            string errorMessagePrefix = "ClaimActivityService Validate(ClaimActivityServiceModel) method does not work properly.";

            var context = HealthInsDbContextInMemoryFactory.InitializeContext();

            this.claimActivityService = new ClaimActivityService(context, new ContractService(context));
            await SeedData(context);

            ClaimActivityServiceModel claim = new ClaimActivityServiceModel()
            {
                Id              = 14,
                ContractId      = 2,
                ClaimDate       = DateTime.Parse("01/01/2019"),
                OperationAmount = operationAmount
            };

            var actualResults = await this.claimActivityService.Create(claim);

            var actualResults2 = await this.claimActivityService.Validate(claim);

            var      actualEntry = this.claimActivityService.GetById(14);
            Contract contract    = context.Contracts.Include(c => c.Person).SingleOrDefault(p => p.Id == claim.ContractId);
            Person   person      = context.Persons.SingleOrDefault(p => p.Id == contract.Person.Id);

            Assert.True(claim.ContractId == actualEntry.ContractId, errorMessagePrefix + " " + "Contract is not returned properly.");
            Assert.True(claim.ClaimDate.ToShortDateString() == actualEntry.ClaimDate.ToShortDateString(), errorMessagePrefix + " " + "ClaimDate is not returned properly.");
            Assert.True(claim.OperationAmount == actualEntry.OperationAmount, errorMessagePrefix + " " + "OperationAmount is not returned properly.");
            Assert.True(HealthIns.Data.Models.Financial.Enums.Status.Paid == actualEntry.Status, errorMessagePrefix + " " + "ClaimActivity Status is not set properly.");
            Assert.True(Status.Canceled == contract.Status, errorMessagePrefix + " " + "Contract Status is not set properly.");
            Assert.True(person.EndDate.ToShortDateString() == actualEntry.ClaimDate.ToShortDateString(), errorMessagePrefix + " " + "Person EndDate is not set properly.");
        }
예제 #2
0
 public ContractController(IContractService contractService, IProductService productService, IPremiumService premiumService, IMoneyInService moneyInService, IClaimActivityService claimActivityService)
 {
     this.contractService      = contractService;
     this.productService       = productService;
     this.premiumService       = premiumService;
     this.moneyInService       = moneyInService;
     this.claimActivityService = claimActivityService;
 }
        public async Task FindClaimsActivityByContractId_ShouldReturnCorrectResults()
        {
            string errorMessagePrefix = "ClaimActivityService FindClaimsActivityByContractId(long id) method does not work properly.";

            var context = HealthInsDbContextInMemoryFactory.InitializeContext();

            this.claimActivityService = new ClaimActivityService(context, new ContractService(context));
            await SeedData(context);

            var actualResults = this.claimActivityService.FindClaimsActivityByContractId(4);

            Assert.True(actualResults.Count() == 1, errorMessagePrefix + " " + "ClaimActivity not found.");
        }
        public async Task GetById_NotExistingClaimActivityt_ShouldReturnCorrectResults()
        {
            string errorMessagePrefix = " ClaimActivityService GetById(long id) method does not work properly.";

            var context = HealthInsDbContextInMemoryFactory.InitializeContext();

            this.claimActivityService = new ClaimActivityService(context, new ContractService(context));
            await SeedData(context);

            var actualResults = this.claimActivityService.GetById(12345);

            Assert.True(actualResults == null, errorMessagePrefix);
        }
예제 #5
0
 public ClaimActivityController(IClaimActivityService claimActivityService, IContractService contractService)
 {
     this.claimActivityService = claimActivityService;
     this.contractService      = contractService;
 }