public void WhenIInquireAMemberCurrentOOPAmount() { try { // Action & Asserion using (var context = new BenefitDbContext(_options)) { var benefitDb = new BenefitRepository(context); var benefit = new MultiTierBenefit(benefitDb); _claimTotalMember1 = benefit.GetOopMaxMet("X0001"); _claimTotalMember2 = benefit.GetOopMaxMet("X0002"); } } catch (Exception e) { // Any exception occurs, it should be considered testing failed. e.Message.Should().BeNullOrEmpty(); } finally { if (_conn.State != ConnectionState.Closed) { _conn.Close(); } _conn.Dispose(); } }
public void GivenTheTableBelowRecordsInsuredMemberMedicalClaimForAllTiers(Table table) { var claims = table.CreateSet <Claim>(); _conn = new SqliteConnection("DataSource=:memory:"); _options = new DbContextOptionsBuilder <BenefitDbContext>().UseSqlite(_conn).Options; try { _conn.Open(); // Arrange using (var context = new BenefitDbContext(_options)) { // Make sure BenefitDbContext object has defined "Claim" table // Create the schema and exit to force it to create immediately context.Database.EnsureCreated(); } // Action using (var context = new BenefitDbContext(_options)) { // Add records to Claim table for assertion foreach (Claim claim in claims) { context.Claims.Add(claim); } var writeCount = context.SaveChanges(); } } catch (Exception e) { } }
public void TestGetDeductibleDdQueryOperation() { var deduct1 = new Deductible() { ProductId = "ABC00001", Level = 1, Amount = 2000 }; var deduct2 = new Deductible() { ProductId = "ABC00001", Level = 2, Amount = 3000 }; var conn = new SqliteConnection("DataSource=:memory:"); var options = new DbContextOptionsBuilder <BenefitDbContext>().UseSqlite(conn).Options; try { conn.Open(); // Arrange using (var context = new BenefitDbContext(options)) { // Create the schema and exit to force it to create immediately context.Database.EnsureCreated(); } // Action using (var context = new BenefitDbContext(options)) { // Add records to Deductible table for assertion context.Deductibles.Add(deduct1); context.Deductibles.Add(deduct2); var writeCount = context.SaveChanges(); } // Action & Asserion using (var context = new BenefitDbContext(options)) { var benefitDb = new BenefitRepository(context); var deduct = benefitDb.GetDeductible("ABC00001"); deduct.FirstOrDefault <Deductible>().ProductId.Should().Be("ABC00001"); } } catch (Exception e) { e.Message.Should().BeEmpty(); } finally { if (conn.State != ConnectionState.Closed) { conn.Close(); } conn.Dispose(); } }
public void TestDatabaseWriteOperation() { var deduct1 = new Deductible() { ProductId = "ABC00002", Level = 1, Amount = 1000 }; var deduct2 = new Deductible() { ProductId = "ABC00002", Level = 2, Amount = 2000 }; var conn = new SqliteConnection("DataSource=:memory:"); conn.Open(); var options = new DbContextOptionsBuilder <BenefitDbContext>().UseSqlite(conn).Options; try { // Arrange using (var context = new BenefitDbContext(options)) { // Create the schema and exit to force it to create immediately var isCreated = context.Database.EnsureCreated(); isCreated.Should().BeTrue(); } // Action using (var context = new BenefitDbContext(options)) { // Add records to Deductible table for assertion context.Deductibles.Add(deduct1); context.Deductibles.Add(deduct2); var writeCount = context.SaveChanges(); writeCount.Should().Be(2); } } catch (Exception e) { e.Message.Should().BeEmpty(); //e.Message.Should().NotBeEmpty(); } finally { if (conn.State != ConnectionState.Closed) { conn.Close(); } conn.Dispose(); } }
public void GivenTheTableBelowContainsASampleOfInsuredMemberMedicalClaimsForAllTiers(Table table) { var claims = table.CreateSet <Claim>(); _conn = new SqliteConnection("DataSource=:memory:"); _options = new DbContextOptionsBuilder <BenefitDbContext>().UseSqlite(_conn).Options; try { _conn.Open(); // Arrange using (var context = new BenefitDbContext(_options)) { // Make sure BenefitDbContext object has defined "Claim" table // Create the schema and exit to force it to create immediately context.Database.EnsureCreated(); } // Action using (var context = new BenefitDbContext(_options)) { // Add records to Claim table for assertion foreach (Claim claim in claims) { context.Claims.Add(claim); } var oopMax = new OopMax() { ProductId = "ABC00001", Amount = 500 }; context.OopMaxes.Add(oopMax); var writeCount = context.SaveChanges(); } } catch (Exception e) { // Any exception occurs, it should be considered testing failed. e.Message.Should().BeNullOrEmpty(); } }
public void WhenIInquireAMemberCurrentOOPAmount() { try { // Action & Asserion using (var context = new BenefitDbContext(_options)) { var benefitDb = new BenefitRepository(context); var benefit = new MultiTierBenefit(benefitDb); _claimTotal = benefit.GetClaimTotal("X0002"); } } catch (Exception e) { } finally { if (_conn.State != ConnectionState.Closed) { _conn.Close(); } _conn.Dispose(); } }