public void TestDataAnnotations() { OxfordLineItem lineItem = new OxfordLineItem(); try { lineItem.Month = 0; lineItem.Year = 13; } catch { //Assert.Inconclusive(ex.Message); } Assert.AreNotEqual(0, lineItem.Month, "Validation failed: Month == 0"); Assert.AreNotEqual(13, lineItem.Year, "Validation failed: Year == 13"); }
static OxfordLineItem ProcessRow(DataRow row) { /// only use rows with the code /// (other rows are not data) if (row[0].ToString() != CfgCode) return null; OxfordLineItem lineItem = new OxfordLineItem(); // columns in order from 6 - 15 lineItem.GroupCode = row[6].ToString(); lineItem.GroupName = row[7].ToString(); lineItem.InvoicePeriod = row[8].ToString(); lineItem.AmountBilled = row.DecimalAt(9); lineItem.PaymentReceived = row.DecimalOrNullAt(10); lineItem.PercentOfPremium = row.DoubleOrNullAt(11); lineItem.PEPM = row.IntAt(12); lineItem.SubCountPEPM = row.IntOrNullAt(13, "N/A"); lineItem.CommissionAmount = row.DecimalOrNullAt(14); lineItem.AmountDue = row.DecimalAt(15); return lineItem; }