public void TestProjectCreate() { string ProjectName = "TestProject"; string ProjectDesc = "We Rock!"; bool ActiveFlg = true; var Project_bll = new sp_Project_BLL(); var Project_dm = new sp_Project_DM(); var VendAdress_bll = new sp_VendAddress_BLL(); Project_dm.ProjectName = ProjectName; Project_dm.ProjectDesc = ProjectDesc; var allAddresses = VendAdress_bll.ListAddresses(); Assert.IsTrue(allAddresses.Count > 0, "The ListAddresses() is broken, or no data in DB"); Project_dm.AddrID = allAddresses[0].AddrID; Project_dm.ActiveFlg = ActiveFlg; var ProjectID = Project_bll.InsertProjectContext(ref Project_dm).ProjectID; Project_dm.ProjectID = ProjectID; var Project_dm_selected = Project_bll.ListProjects(ProjectID); Assert.IsTrue(Equals(Project_dm, Project_dm_selected)); }
public void TestProjectEventCreate() { DateTime StartDate = new DateTime(2014, 05, 01, 10, 0, 0); DateTime EndDate = new DateTime(2014, 05, 02, 11, 0, 0); var ProjectEvent_bll = new sp_ProjectEvent_BLL(); var ProjectEvent_dm = new sp_ProjectEvent_DM(); var Project_bll = new sp_Project_BLL(); var VendAdress_bll = new sp_VendAddress_BLL(); ProjectEvent_dm.StartDateTime = StartDate; ProjectEvent_dm.EndDateTime = EndDate; var allProjects = Project_bll.ListProjects(); Assert.IsTrue(allProjects.Count > 0, "The ListProjects() is broken, or no data in DB"); ProjectEvent_dm.ProjectID = allProjects[0].ProjectID; var allAddresses = VendAdress_bll.ListAddresses(); Assert.IsTrue(allAddresses.Count > 0, "The ListAddresses() is broken, or no data in DB"); ProjectEvent_dm.AddrID = allAddresses[0].AddrID; //var ProjectID = ProjectEvent_bll.InsertEventContext(ref ProjectEvent_dm).ProjectID; //ProjectEvent_dm.ProjectID = ProjectID; //var ProjectEvent_dm_selected = ProjectEvent_bll.ListEvents(ProjectID); //Assert.IsTrue(Equals(ProjectEvent_dm, ProjectEvent_dm_selected)); }
protected void getAddresses() { sp_VendorAddr_BLL vendAddrBLL = new sp_VendorAddr_BLL(); sp_VendAddress_BLL addressBLL = new sp_VendAddress_BLL(); foreach (sp_VendorAddr_DM vendAddr in vendAddrBLL.ListAllAddresses((Guid)currentUser.ProviderUserKey)) { addresses.Add(addressBLL.ListAddresses(vendAddr.AddrID)); } }
public void TestVendAddressRead() { //Test Our Read DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "VendAddress.xlsx")); foreach (DataRow row in dt.Rows) // Loop over the rows. { int AddrID = Convert.ToInt32(row["AddrID"].ToString()); sp_VendAddress_BLL vend = new sp_VendAddress_BLL(); sp_VendAddress_DM data = vend.ListAddresses(AddrID); Assert.AreEqual(row["AddrLine1"].ToString(), data.AddrLine1, "AddrLine1 Not Set As Expected"); Assert.AreEqual(row["AddrLine2"].ToString(), data.AddrLine2, "AddrLine2 Not Set As Expected"); Assert.AreEqual(row["AddrLine3"].ToString(), data.AddrLine3, "AddrLine3 Not Set As Expected"); Assert.AreEqual(row["City"].ToString(), data.City, "City Not Set As Expected"); Assert.AreEqual(row["St"].ToString(), data.St, "St Not Set As Expected"); Assert.AreEqual(Convert.ToInt32(row["Zip"]), data.Zip, "Zip Not Set As Expected"); //Floats don't work Assert.AreEqual(Convert.ToInt32(row["Zip4"]), data.Zip4, "Zip4 Not Set As Expected"); //Ints don't work } }
public void TestVendAddressDelete() { DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "VendAddress.xlsx")); foreach (DataRow row in dt.Rows) // Loop over the rows. { int AddrID = Convert.ToInt32(row["AddrID"].ToString()); sp_VendAddress_DM data = new sp_VendAddress_DM(); sp_VendAddress_BLL vend = new sp_VendAddress_BLL(); data.AddrID = AddrID; vend.DeleteAddressContext(data); data = vend.ListAddresses(AddrID); Assert.AreEqual(false, data.ActiveFlg, "ActiveFlag not set as expected"); } }
public void TestVendorAddrReadAll() { //Pull our data from the excel file string helperDir = cExcel.GetHelperFilesDir(); DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(helperDir, "VendAddress.xlsx")); //Pull our data directly from the DB var numRows = cExcel.getNumRecordsFromDB("[Vend].[tblVendAddress]"); //Pull our data from the DB through the BLL sp_VendAddress_BLL vendor = new sp_VendAddress_BLL(); var allVendors = vendor.ListAddresses(); //Test the data from the BLL Assert.AreEqual(numRows, allVendors.Count); }
public void TestVendAddressUpdate() { //Test Our Read DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(cExcel.GetHelperFilesDir(), "VendAddress.xlsx")); foreach (DataRow row in dt.Rows) // Loop over the rows. { string AddrLine1 = "TestAddrLine1"; string AddrLine2 = "TestAddrLine2"; string AddrLine3 = "TestAddrLine3"; string City = "TestCity"; string St = "TestSt"; int Zip = 11111; int Zip4 = 1111; int AddrID = Convert.ToInt32(row["AddrID"].ToString()); sp_VendAddress_DM data = new sp_VendAddress_DM(); data.AddrID = AddrID; data.AddrLine1 = AddrLine1; data.AddrLine2 = AddrLine2; data.AddrLine3 = AddrLine3; data.City = City; data.St = St; data.Zip = Zip; data.Zip4 = Zip4; sp_VendAddress_BLL vend = new sp_VendAddress_BLL(); vend.UpdateAddressContext(data); data = vend.ListAddresses(AddrID); Assert.AreEqual(AddrLine1, data.AddrLine1, "AddrLine1 Not Set As Expected"); Assert.AreEqual(AddrLine2, data.AddrLine2, "AddrLine2 Not Set As Expected"); Assert.AreEqual(AddrLine3, data.AddrLine3, "AddrLine3 Not Set As Expected"); Assert.AreEqual(City, data.City, "City Not Set As Expected"); Assert.AreEqual(St, data.St, "St Not Set As Expected"); Assert.AreEqual(Zip, data.Zip, "Zip Not Set As Expected"); Assert.AreEqual(Zip4, data.Zip4, "Zip4 Not Set As Expected"); } }