public void Build_report_by_client() { Property("Type", 2); report = new SupplierMarketShareByUser(Conn, properties); BuildReport("SupplierMarketShareByUserByClient.xls"); }
public void Build_report_by_address() { Property("Type", 1); report = new SupplierMarketShareByUser(Conn, properties); BuildReport("SupplierMarketShareByUserByAddress.xls"); }
public void Build_report() { Property("Type", 0); report = new SupplierMarketShareByUser(Conn, properties); BuildReport(); }
public void SetTotalSumTest() { var testReport = new SupplierMarketShareByUser(); var table = new DataTable("testTable"); table.Columns.Add("TotalSum"); table.Columns.Add("SupplierSum"); table.Columns.Add("PrevTotalSum"); table.Columns.Add("PrevSupplierSum"); var dataRow = table.NewRow(); var resultTable = new DataTable("resultTable"); resultTable.Columns.Add("Share"); resultTable.Columns.Add("SupplierSum"); var resultRow = resultTable.NewRow(); dataRow["TotalSum"] = 0; testReport.SetTotalSum(dataRow, resultRow); Assert.AreEqual(resultRow["Share"], DBNull.Value); dataRow["TotalSum"] = 100000; dataRow["SupplierSum"] = 5000; testReport.SetTotalSum(dataRow, resultRow); Assert.AreEqual("5,00", resultRow["Share"]); dataRow["SupplierSum"] = 20000; testReport.SetTotalSum(dataRow, resultRow); Assert.AreEqual("20,0", resultRow["Share"]); }
public void Build_report_by_legal_entity() { Property("Type", 3); report = new SupplierMarketShareByUser(Conn, properties); BuildReport("SupplierMarketShareByUserByLegalEntity.xls"); }
public void Build_report_without_notAccepted_orders() { Property("Type", 0); var order2 = CreateOrder(null, supplier); order2.Deleted = true; session.Save(order2); var order3 = CreateOrder(null, supplier); order3.Submited = false; session.Save(order3); report = new SupplierMarketShareByUser(Conn, properties); var resfile = "RepWithoutNotAcceptedOrders.xls"; BuildReport(resfile); Assert.IsTrue(File.Exists(resfile)); var repTable = report.GetReportTable(); bool acceptedOrder = false; foreach (DataRow row in repTable.Rows) { if (!String.IsNullOrEmpty(row.ItemArray[2].ToString())) { Assert.AreNotEqual(row.ItemArray[2].ToString(), order2.User.Id.ToString()); Assert.AreNotEqual(row.ItemArray[2].ToString(), order3.User.Id.ToString()); if (order.User.Id.ToString().Equals(row.ItemArray[2].ToString())) { acceptedOrder = true; } } } Assert.True(acceptedOrder); }