public void TestEventRatingCreate() { DateTime StartDate = new DateTime(2014, 05, 01, 10, 0, 0); DateTime EndDate = new DateTime(2014, 05, 02, 11, 0, 0); var EventRating_bll = new sp_EventRating_BLL(); var EventRating_dm = new sp_EventRating_DM(); var Event_bll = new sp_ProjectEvent_BLL(); var allEvents = Event_bll.ListEvents(); Assert.IsTrue(allEvents.Count > 0, "The ListEventRatings() is broken, or no data in DB"); EventRating_dm.EventID = allEvents[0].EventID; EventRating_dm.ActiveFlg = true; int RatingID = EventRating_bll.InsertEventRatingContext(EventRating_dm).RatingID; EventRating_dm.RatingID = RatingID; var EventRating_dm_selected = EventRating_bll.ListEventRatings(RatingID); Assert.IsTrue(Equals(EventRating_dm, EventRating_dm_selected)); }
public void TestEventRatingDelete() { var EventRating_bll = new sp_EventRating_BLL(); var allEventRatings = EventRating_bll.ListEventRatings(); Assert.IsTrue(allEventRatings.Count > 0, "The ListEventRatings() is broken, or no data in DB"); var currEventRating = allEventRatings[0]; var notActive = currEventRating.ActiveFlg != true; var i = 1; while (notActive) { currEventRating = allEventRatings[i]; notActive = currEventRating.ActiveFlg != true; } EventRating_bll.DeleteEventRatingContext(currEventRating); var selectedEventRating = EventRating_bll.ListEventRatings(currEventRating.RatingID); Assert.IsFalse(selectedEventRating.ActiveFlg); }
public void TestEventRatingRead() { //Pull our data from the excel file string helperDir = cExcel.GetHelperFilesDir(); DataTable dt = cExcel.ReadExcelFile("Sheet1", Path.Combine(helperDir, "EventRating.xlsx")); var excelDMs = DMsFrom(dt); //Pull our data directly from the DB var numRows = cExcel.getNumRecordsFromDB("[Vend].[tblEventRating]"); //Pull our data from the DB through the BLL var EventRating_bll = new sp_EventRating_BLL(); var allEventRatings = EventRating_bll.ListEventRatings(); //Test the data from the BLL Assert.AreEqual(numRows, allEventRatings.Count); foreach (var testEventRating in excelDMs) { var selectedEventRating = EventRating_bll.ListEventRatings(testEventRating.RatingID); Assert.IsTrue(Equals(testEventRating, selectedEventRating)); } }
public void TestEventRatingUpdate() { var EventRating_bll = new sp_EventRating_BLL(); var allEventRatings = EventRating_bll.ListEventRatings(); Assert.IsTrue(allEventRatings.Count > 0, "The ListEventRatings() is broken, or no data in DB"); var firstEventRating = allEventRatings[0]; firstEventRating.RatingValue = firstEventRating.RatingValue + 1; firstEventRating.ActiveFlg = !firstEventRating.ActiveFlg; EventRating_bll.UpdateEventRatingContext(firstEventRating); var selectedEventRating = EventRating_bll.ListEventRatings(firstEventRating.RatingID); Assert.IsTrue(Equals(firstEventRating, selectedEventRating)); }