public void AddMissingColumnsTest() { VetLabReportDataSet data = GetFilledDataSet("test_name"); ReportArchiveHelper.GetCaptionsAndAssignToColumns(data.spRepVetLabReportAZ, "strTestName_"); Assert.IsTrue(data.spRepVetLabReportAZ.Columns.Contains("strTestName_1")); Assert.IsTrue(data.spRepVetLabReportAZ.Columns.Contains("intTest_1")); var nameCaptions = new List <string> { "test_aaa", "test_name", "test_zzz" }; VetLabReport.AddMissingColumns(data.spRepVetLabReportAZ, nameCaptions); Assert.IsTrue(data.spRepVetLabReportAZ.Columns.Contains("strTestName_1")); Assert.IsTrue(data.spRepVetLabReportAZ.Columns.Contains("intTest_1")); Assert.IsTrue(data.spRepVetLabReportAZ.Columns.Contains("strTestName_2")); Assert.IsTrue(data.spRepVetLabReportAZ.Columns.Contains("intTest_2")); Assert.IsTrue(data.spRepVetLabReportAZ.Columns.Contains("strTestName_3")); Assert.IsTrue(data.spRepVetLabReportAZ.Columns.Contains("intTest_3")); Assert.AreEqual("test_aaa", data.spRepVetLabReportAZ.Columns["strTestName_1"].Caption); Assert.AreEqual("test_name", data.spRepVetLabReportAZ.Columns["strTestName_2"].Caption); Assert.AreEqual("test_zzz", data.spRepVetLabReportAZ.Columns["strTestName_3"].Caption); Assert.AreEqual(DBNull.Value, data.spRepVetLabReportAZ.Rows[0]["intTest_1"]); Assert.AreEqual(2, data.spRepVetLabReportAZ.Rows[0]["intTest_2"]); Assert.AreEqual(DBNull.Value, data.spRepVetLabReportAZ.Rows[0]["intTest_3"]); }
public void SetTestNameCaptionsTest() { VetLabReportDataSet data = GetFilledDataSet("test_name"); List <string> nameCaptions = ReportArchiveHelper.GetCaptionsAndAssignToColumns(data.spRepVetLabReportAZ, "strTestName_"); Assert.AreEqual(1, nameCaptions.Count); Assert.AreEqual("test_name", nameCaptions[0]); Assert.AreEqual("test_name", data.spRepVetLabReportAZ.Columns["strTestName_1"].Caption); }