public async Task Create_ShouldReturnCorrectResults(double operationAmount) { string errorMessagePrefix = "PremiumService Create(PremiumServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.moneyInService = new MoneyInService(context); await SeedData(context); MoneyInServiceModel moneyIn = new MoneyInServiceModel() { Id = 14, ContractId = 2, OperationAmount = operationAmount }; var actualResults = await this.moneyInService.Create(moneyIn); var actualEntry = context.MoneyIns.Include(m => m.Contract).SingleOrDefault(m => m.Id == 14); var contract = context.Contracts.SingleOrDefault(c => c.Id == actualEntry.Contract.Id); Assert.True(moneyIn.ContractId == actualEntry.Contract.Id, errorMessagePrefix + " " + "Contract is not returned properly."); Assert.True(moneyIn.OperationAmount == actualEntry.OperationAmount, errorMessagePrefix + " " + "OperationAmount is not returned properly."); Assert.True(HealthIns.Data.Models.Financial.Enums.Status.Pending == actualEntry.Status, errorMessagePrefix + " " + "Status is not set properly."); }
public async Task Create_ShouldReturnCorrectResults() { string errorMessagePrefix = "OrganizationService Create(OrganizationServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.organizationService = new OrganizationService(context); await SeedData(context); OrganizationServiceModel newOrg = new OrganizationServiceModel() { Id = 3, Vat = "1122222256", EndDate = DateTime.Now, FullName = "Org 22", StartDate = DateTime.Parse("01/01/1996") }; var actualResults = await this.organizationService.Create(newOrg); var actualEntry = this.organizationService.GetById(3); Assert.True(newOrg.FullName == actualEntry.FullName, errorMessagePrefix + " " + "FullName is not returned properly."); Assert.True(newOrg.Vat == actualEntry.Vat, errorMessagePrefix + " " + "Vat is not returned properly."); Assert.True(newOrg.StartDate.ToShortDateString() == actualEntry.StartDate.ToShortDateString(), errorMessagePrefix + " " + "StartDate is not returned properly."); Assert.True(newOrg.EndDate.ToShortDateString() == actualEntry.EndDate.ToShortDateString(), errorMessagePrefix + " " + "EndDate is not returned properly."); }
public async Task Create_ShouldReturnCorrectResults() { string errorMessagePrefix = "PremiumService Create(PremiumServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.premiumService = new PremiumService(context, new ContractService(context)); await SeedData(context); PremiumServiceModel prem = new PremiumServiceModel() { Id = 14, ContractId = 2, OperationAmount = 100 }; var actualResults = await this.premiumService.Create(prem); var actualEntry = this.premiumService.GetById(14); var contract = context.Contracts.SingleOrDefault(c => c.Id == actualEntry.ContractId); Assert.True(prem.ContractId == actualEntry.ContractId, errorMessagePrefix + " " + "Contract is not returned properly."); Assert.True(prem.OperationAmount == actualEntry.OperationAmount, errorMessagePrefix + " " + "Contract is not returned properly."); Assert.True(HealthIns.Data.Models.Financial.Enums.Status.Pending == actualEntry.Status, errorMessagePrefix + " " + "Contract is not returned properly."); Assert.True(DateTime.Parse("01/01/2020").ToShortDateString() == contract.NextBillingDueDate.ToShortDateString(), errorMessagePrefix + " " + "Contract NextBillingDueDate is not calculated properly."); }
public async Task TryToApplyFinancial_ShouldNotApply() { string errorMessagePrefix = "ContractService TryToApplyFinancial(long contractId) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.contractService = new ContractService(context); await SeedData(context); var actualResults = this.contractService.GetById(1); var contract = context.Contracts.SingleOrDefault(c => c.Id == 1); var moneyIn = new MoneyIn() { Contract = contract, Status = Data.Models.Financial.Enums.Status.Pending }; context.Add(moneyIn); await context.SaveChangesAsync(); var result = contractService.TryToApplyFinancial(1); Assert.True(moneyIn.Status == Data.Models.Financial.Enums.Status.Pending, errorMessagePrefix); }
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."); }
public async Task GetAllProducts_WithDummyData_ShouldReturnCorrectResults() { string errorMessagePrefix = "ProductService GetAllProducts() method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); await SeedData(context); this.productService = new ProductService(context); List <ProductServiceModel> actualResults = await this.productService.GetAllProducts().ToListAsync(); List <ProductServiceModel> expectedResults = GetDummyDataProduct().To <ProductServiceModel>().ToList(); for (int i = 0; i < expectedResults.Count; i++) { var expectedEntry = expectedResults[i]; var actualEntry = actualResults[i]; Assert.True(expectedEntry.Idntfr == actualEntry.Idntfr, errorMessagePrefix + " " + "Idntfr is not returned properly."); Assert.True(expectedEntry.Label == actualEntry.Label, errorMessagePrefix + " " + "Label is not returned properly."); Assert.True(expectedEntry.MaxAge == actualEntry.MaxAge, errorMessagePrefix + " " + "MaxAge is not returned properly."); Assert.True(expectedEntry.MinAge == actualEntry.MinAge, errorMessagePrefix + " " + "MinAge is not returned properly."); Assert.True(expectedEntry.FrequencyRule == actualEntry.FrequencyRule, errorMessagePrefix + " " + "FrequencyRule Type is not returned properly."); } }
public async Task Update_ShouldReturnCorrectResults() { string errorMessagePrefix = "ContractService Update(ContractServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.contractService = new ContractService(context); await SeedData(context); ContractServiceModel contract = context.Contracts.First().To <ContractServiceModel>(); contract.NextBillingDueDate = DateTime.Now; contract.StartDate = DateTime.Now; contract.Amount = 10000; contract.Frequency = "ANNUAL"; contract.Duration = 12; var actualResults = await this.contractService.Update(contract); var actualEntry = this.contractService.GetById(contract.Id); Assert.True(contract.NextBillingDueDate == actualEntry.NextBillingDueDate, errorMessagePrefix + " " + "NextBillingDueDate is not returned properly."); Assert.True(contract.StartDate == actualEntry.StartDate, errorMessagePrefix + " " + "StartDate is not returned properly."); Assert.True(contract.Amount == actualEntry.Amount, errorMessagePrefix + " " + "Amount is not returned properly."); Assert.True(contract.Frequency == actualEntry.Frequency, errorMessagePrefix + " " + "Frequency is not returned properly."); Assert.True(contract.Duration == actualEntry.Duration, errorMessagePrefix + " " + "Duration is not returned properly."); }
public async Task Create_ShouldReturnCorrectResults() { string errorMessagePrefix = "ProductService Create(ProductServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.productService = new ProductService(context); // await SeedData(context); ProductServiceModel newProduct = new ProductServiceModel() { Id = 1, Idntfr = "LIFE10", Label = "Life 10", FrequencyRule = "MONTHLY", MaxAge = 40, MinAge = 18 }; var actualResults = await this.productService.Create(newProduct); var actualEntry = this.productService.GetById(1); Assert.True(newProduct.Idntfr == actualEntry.Idntfr, errorMessagePrefix + " " + "Idntfr is not returned properly."); Assert.True(newProduct.Label == actualEntry.Label, errorMessagePrefix + " " + "Label is not returned properly."); Assert.True(newProduct.MaxAge == actualEntry.MaxAge, errorMessagePrefix + " " + "MaxAge is not returned properly."); Assert.True(newProduct.MinAge == actualEntry.MinAge, errorMessagePrefix + " " + "MinAge is not returned properly."); Assert.True(newProduct.FrequencyRule == actualEntry.FrequencyRule, errorMessagePrefix + " " + "FrequencyRule Type is not returned properly."); }
public async Task GetAllContracts_WithDummyData_ShouldReturnCorrectResults() { string errorMessagePrefix = "ContractService GetAllContracts() method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); await SeedData(context); this.contractService = new ContractService(context); List <ContractServiceModel> actualResults = await this.contractService.GetAllContracts().ToListAsync(); List <ContractServiceModel> expectedResults = GetDummyDataContract().To <ContractServiceModel>().ToList(); for (int i = 0; i < expectedResults.Count; i++) { var expectedEntry = expectedResults[i]; var actualEntry = actualResults[i]; Assert.True(expectedEntry.Frequency == actualEntry.Frequency, errorMessagePrefix + " " + "Frequency is not returned properly."); Assert.True(expectedEntry.Amount == actualEntry.Amount, errorMessagePrefix + " " + "Amount is not returned properly."); Assert.True(expectedEntry.PremiumAmount == actualEntry.PremiumAmount, errorMessagePrefix + " " + "PremiumAmount is not returned properly."); Assert.True(expectedEntry.NextBillingDueDate == actualEntry.NextBillingDueDate, errorMessagePrefix + " " + "NextBillingDueDate is not returned properly."); Assert.True(expectedEntry.StartDate == actualEntry.StartDate, errorMessagePrefix + " " + "StartDate Type is not returned properly."); } }
public async Task Create_ShouldReturnCorrectResults() { string errorMessagePrefix = "ContractService Create(ContractServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.contractService = new ContractService(context); await SeedData(context); ContractServiceModel newContract = new ContractServiceModel() { Id = 4, Frequency = "ANNUAL", StartDate = DateTime.Parse("01/01/2019"), Duration = 10, ProductIdntfr = "LIFE1", PersonId = 39, DistributorId = 39 }; var actualResults = await this.contractService.Create(newContract); var actualEntry = this.contractService.GetById(4); Assert.True(newContract.Frequency == actualEntry.Frequency, errorMessagePrefix + " " + "Frequency is not returned properly."); Assert.True(newContract.StartDate == actualEntry.StartDate, errorMessagePrefix + " " + "StartDate is not returned properly."); }
public async Task GetAllOrganizations_WithDummyData_ShouldReturnCorrectResults() { string errorMessagePrefix = "OrganizationService GetAllPersons() method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); await SeedData(context); this.organizationService = new OrganizationService(context); List <OrganizationServiceModel> actualResults = await this.organizationService.GetAllOrganizations().ToListAsync(); List <OrganizationServiceModel> expectedResults = GetDummyDataOrganization().To <OrganizationServiceModel>().ToList(); for (int i = 0; i < expectedResults.Count; i++) { var expectedEntry = expectedResults[i]; var actualEntry = actualResults[i]; Assert.True(expectedEntry.FullName == actualEntry.FullName, errorMessagePrefix + " " + "Egn is not returned properly."); Assert.True(expectedEntry.Vat == actualEntry.Vat, errorMessagePrefix + " " + "Vat is not returned properly."); Assert.True(expectedEntry.StartDate.ToShortDateString() == actualEntry.StartDate.ToShortDateString(), errorMessagePrefix + " " + "StartDate is not returned properly."); Assert.True(expectedEntry.EndDate.ToShortDateString() == actualEntry.EndDate.ToShortDateString(), errorMessagePrefix + " " + "EndDate is not returned properly."); } }
public async Task Update_ShouldReturnCorrectResults() { string errorMessagePrefix = "ProductService Update(ProductServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.productService = new ProductService(context); await SeedData(context); ProductServiceModel newProduct = context.Products.First().To <ProductServiceModel>(); newProduct.Idntfr = "LIFE10"; newProduct.Label = "Life 10"; newProduct.FrequencyRule = "ANNUAL"; newProduct.MaxAge = 1; newProduct.MinAge = 2; var actualResults = await this.productService.Update(newProduct); var actualEntry = this.productService.GetById(newProduct.Id); Assert.True(newProduct.Idntfr == actualEntry.Idntfr, errorMessagePrefix + " " + "Idntfr is not returned properly."); Assert.True(newProduct.Label == actualEntry.Label, errorMessagePrefix + " " + "Label is not returned properly."); Assert.True(newProduct.MaxAge == actualEntry.MaxAge, errorMessagePrefix + " " + "MaxAge is not returned properly."); Assert.True(newProduct.MinAge == actualEntry.MinAge, errorMessagePrefix + " " + "MinAge is not returned properly."); Assert.True(newProduct.FrequencyRule == actualEntry.FrequencyRule, errorMessagePrefix + " " + "FrequencyRule Type is not returned properly."); }
public async Task Update_ShouldReturnCorrectResults() { string errorMessagePrefix = "PersonService Update(PersonServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.personService = new PersonService(context); await SeedData(context); PersonServiceModel person = context.Persons.First().To <PersonServiceModel>(); person.Egn = "112222221"; person.EndDate = DateTime.Now.AddDays(2); person.FullName = "Ivan 22"; person.Smoker = true; person.Sex = "Female"; person.StartDate = DateTime.Parse("01/01/1996").AddDays(3); var actualResults = await this.personService.Update(person); var actualEntry = this.personService.GetById(person.Id); Assert.True(person.FullName == actualEntry.FullName, errorMessagePrefix + " " + "Egn is not returned properly."); Assert.True(person.Egn == actualEntry.Egn, errorMessagePrefix + " " + "Egn is not returned properly."); Assert.True(person.StartDate.ToShortDateString() == actualEntry.StartDate.ToShortDateString(), errorMessagePrefix + " " + "StartDate is not returned properly."); Assert.True(person.Sex == actualEntry.Sex, errorMessagePrefix + " " + "Sex is not returned properly."); Assert.True(person.EndDate.ToShortDateString() == actualEntry.EndDate.ToShortDateString(), errorMessagePrefix + " " + "EndDate is not returned properly."); Assert.True(person.Smoker == actualEntry.Smoker, errorMessagePrefix + " " + "Smoker Type is not returned properly."); }
public async Task Create_ShouldReturnCorrectResults() { string errorMessagePrefix = "ContractService Create(ContractServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.personService = new PersonService(context); await SeedData(context); PersonServiceModel newPerson = new PersonServiceModel() { Id = 3, Egn = "11222222", EndDate = DateTime.Now, FullName = "Ivan 2", Smoker = false, Sex = "Male", StartDate = DateTime.Parse("01/01/1996") }; var actualResults = await this.personService.Create(newPerson); var actualEntry = this.personService.GetById(3); Assert.True(newPerson.FullName == actualEntry.FullName, errorMessagePrefix + " " + "Egn is not returned properly."); Assert.True(newPerson.Egn == actualEntry.Egn, errorMessagePrefix + " " + "Egn is not returned properly."); Assert.True(newPerson.StartDate.ToShortDateString() == actualEntry.StartDate.ToShortDateString(), errorMessagePrefix + " " + "StartDate is not returned properly."); Assert.True(newPerson.Sex == actualEntry.Sex, errorMessagePrefix + " " + "Sex is not returned properly."); Assert.True(newPerson.EndDate.ToShortDateString() == actualEntry.EndDate.ToShortDateString(), errorMessagePrefix + " " + "EndDate is not returned properly."); Assert.True(newPerson.Smoker == actualEntry.Smoker, errorMessagePrefix + " " + "Smoker Type is not returned properly."); }
public async Task Update_ShouldReturnCorrectResults() { string errorMessagePrefix = "OrganizationService Update(OrganizationServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.organizationService = new OrganizationService(context); await SeedData(context); OrganizationServiceModel org = context.Organizations.First().To <OrganizationServiceModel>(); org.Vat = "11222222133"; org.EndDate = DateTime.Now.AddDays(2); org.FullName = "Org 678"; org.StartDate = DateTime.Parse("01/01/1996").AddDays(3); var actualResults = await this.organizationService.Update(org); var actualEntry = this.organizationService.GetById(org.Id); Assert.True(org.FullName == actualEntry.FullName, errorMessagePrefix + " " + "FullName is not returned properly."); Assert.True(org.Vat == actualEntry.Vat, errorMessagePrefix + " " + "Egn is not returned properly."); Assert.True(org.StartDate.ToShortDateString() == actualEntry.StartDate.ToShortDateString(), errorMessagePrefix + " " + "StartDate is not returned properly."); Assert.True(org.EndDate.ToShortDateString() == actualEntry.EndDate.ToShortDateString(), errorMessagePrefix + " " + "EndDate is not returned properly."); }
public async Task GetAllProducts_WithZeroData_ShouldReturnEmptyResults() { string errorMessagePrefix = "ProductService GetAllProducts() method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.productService = new ProductService(context); List <ProductServiceModel> actualResults = await this.productService.GetAllProducts().ToListAsync(); Assert.True(actualResults.Count == 0, errorMessagePrefix); }
public async Task VerifyVat_ShouldNotReturnResults() { string errorMessagePrefix = "PersonService VerifyEgn(string egn) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.organizationService = new OrganizationService(context); await SeedData(context); var actualResults = this.organizationService.VerifyVat("7546456233"); Assert.True(actualResults == null, errorMessagePrefix); }
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); }
public async Task GetById_WithExistingOrganization_ShouldReturnCorrectResults() { string errorMessagePrefix = "OrganizationServiceModel GetById(long id) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.organizationService = new OrganizationService(context); await SeedData(context); var actualResults = this.organizationService.GetById(1); Assert.True(actualResults != null, errorMessagePrefix); }
public async Task GetById_WithNotExistingDistributorn_ShouldReturnEmptyResults() { string errorMessagePrefix = "DistributorServiceModel GetById(long id) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.distributorService = new DistributorService(context); await SeedData(context); var actualResults = this.distributorService.GetById(5); Assert.True(actualResults == null, errorMessagePrefix); }
public async Task FindPremiumsByContractId_ShouldReturnCorrectResults() { string errorMessagePrefix = "PremiumService FindPremiumsByContractId(long id) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.premiumService = new PremiumService(context, new ContractService(context)); await SeedData(context); var actualResults = this.premiumService.FindPremiumsByContractId(4); Assert.True(actualResults.Count() == 1, errorMessagePrefix + " " + "OperationAmount is not returned properly."); }
public async Task GetByIdntfr_WithNotExistingProduct_ShouldReturnCorrectResults() { string errorMessagePrefix = "ProductService GetByIdntfr(string productIdntfr) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.productService = new ProductService(context); await SeedData(context); var actualResults = this.productService.GetByIdntfr("LIFE133"); Assert.True(actualResults == null, errorMessagePrefix); }
public async Task FindMoneyInsByContractIdShouldReturnEmptyResult() { string errorMessagePrefix = "PremiumService FindMoneyInsByContractId(long id) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.moneyInService = new MoneyInService(context); await SeedData(context); var actualResults = this.moneyInService.FindMoneyInsByContractId(45); Assert.True(!actualResults.Any(), errorMessagePrefix + " " + "Money in Is Found"); }
public async Task VerifyEgn_ShouldReturnResults() { string errorMessagePrefix = "PersonService VerifyEgn(string egn) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.personService = new PersonService(context); await SeedData(context); var actualResults = this.personService.VerifyEgn("123456"); Assert.True(actualResults.Id == 1, errorMessagePrefix); }
public async Task CalculateNextBillingDueDate_ShouldReturnCorrectResults(string nextDate, string frequency, string expectedDate) { var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.contractService = new ContractService(context); await SeedData(context); var actualEntry = this.contractService.GetById(1); Contract contract = context.Contracts.SingleOrDefault(c => c.Id == 1); contract.NextBillingDueDate = DateTime.Parse(nextDate); contract.Frequency = frequency; var nextBillingDueDate = this.contractService.CalculateNextBillingDueDate(contract); Assert.Equal(DateTime.Parse(expectedDate).ToShortDateString(), nextBillingDueDate.ToShortDateString()); }
public async Task CheckProductRules_ShouldReturnGoodResults_ForPersonAge(string startDate) { string errorMessagePrefix = "ProductService CheckProductRules(ContractServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.productService = new ProductService(context); this.contractService = new ContractService(context); await SeedData(context); var contract = this.contractService.GetById(1); contract.Person.StartDate = DateTime.Parse(startDate); var actualResults = this.productService.CheckProductRules(contract); Assert.True(actualResults.Count == 0, errorMessagePrefix); }
public async Task CheckProductRules_ShouldReturnErrorResults(string frequency) { string errorMessagePrefix = "ProductService CheckProductRules(ContractServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.productService = new ProductService(context); this.contractService = new ContractService(context); await SeedData(context); var contract = this.contractService.GetById(2); contract.Frequency = frequency; var actualResults = this.productService.CheckProductRules(contract); Assert.True(actualResults.Count != 0, errorMessagePrefix); }
public async Task ReturnPremiumAmount_ShouldReturnCorrectResults(double benefitAmount, double expectedAmount) { var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.contractService = new ContractService(context); await SeedData(context); var actualEntry = this.contractService.GetById(1); Contract contract = context.Contracts.SingleOrDefault(c => c.Id == 1); contract.Amount = benefitAmount; await context.SaveChangesAsync(); var amount = this.contractService.ReturnPremiumAmount(contract); Assert.Equal(expectedAmount, amount); }
public async Task SearchContract_EmptyCriteria_ShouldReturnAny() { string errorMessagePrefix = "ContractService SearchContract(ContractServiceModel) method does not work properly."; var context = HealthInsDbContextInMemoryFactory.InitializeContext(); this.contractService = new ContractService(context); await SeedData(context); ContractSearchViewModel contractSearchInputModel = new ContractSearchViewModel() { }; var actualResults = this.contractService.SearchContract(contractSearchInputModel); Assert.True(actualResults.Any(), errorMessagePrefix); }