private void SetupUowForNotificationTest(IUnitOfWork unitOfWork, out Trip tripEntity, out List <Step> steps) { Diagnostics = new IdtoDiagnostics(); //to avoid null ref exc. set up base diagnostics. tripEntity = TestData.GetTripForNotificationTest(); steps = TestData.GetSteps(); //trips and steps get added in savetrip service call ITripService tripService = new TripService(5); int id = tripService.SaveTrip(tripEntity, steps, unitOfWork); }
/// <summary> /// Note, this setup is a bit 'integration test-y' because I call SaveTrip to load up all the stuff and the Tconnect. /// </summary> /// <param name="unitOfWork"></param> /// <param name="tripEntity"></param> /// <param name="steps"></param> /// <param name="mt"></param> private void SetupUowWithTripAndTConnect(IUnitOfWork unitOfWork, out Trip tripEntity, out List <Step> steps, out TConnect mt) { Diagnostics = new IdtoDiagnostics(); //to avoid null ref exc. set up base diagnostics. tripEntity = TestData.GetTrip(); steps = TestData.GetSteps(); //trips and steps get added in savetrip service call TConnectOpportunity TConnOpp = TestData.GetTConnectOpportunity(); unitOfWork.Repository <TConnectOpportunity>().Insert(TConnOpp); unitOfWork.Save(); ITripService tripService = new TripService(5); int id = tripService.SaveTrip(tripEntity, steps, unitOfWork); //Get the TConnect just created by the SaveTrip function mt = unitOfWork.Repository <TConnect>().Query().Get().First(); Assert.AreEqual(1, unitOfWork.Repository <TConnect>().Query().Get().Count(), "TConnect that should have been created by SaveTrip did not get created."); }