/// <summary> /// Gets the profile of a team's season schedule /// </summary> /// <param name="teamName">The name of the selected team</param> /// <param name="seasonID">The ID of the selected season</param> /// <returns>The result of the stored procedure execution</returns> public ObjectResult <GetTeamSeasonScheduleProfile_Result> GetTeamSeasonScheduleProfile(string teamName, int?seasonID) { try { return(_dbContext.GetTeamSeasonScheduleProfile(teamName, seasonID)); } catch (ArgumentException ex) { _log.Error( $"Argument exception in StoredProcedureRepository.GetTeamSeasonScheduleProfile: {ex.Message}"); throw; } catch (InvalidOperationException ex) { _log.Error($"Invalid operation in StoredProcedureRepository.GetTeamSeasonScheduleProfile: {ex.Message}"); throw; } catch (Exception ex) { _log.Error(ex.Message); throw; } }
public static void SetUpFakeTeamSeasonScheduleProfile(this ProFootballEntities dbContext, IEnumerable <GetTeamSeasonScheduleProfile_Result> teamSeasonScheduleProfile = null) { var fakeObjectResult = A.Fake <ObjectResult <GetTeamSeasonScheduleProfile_Result> >(d => d.Implements(typeof(IEnumerable <GetTeamSeasonScheduleProfile_Result>))); // Setup all IEnumerable methods using what you have from "fakeObjectResult" A.CallTo(() => (fakeObjectResult as IEnumerable <GetTeamSeasonScheduleProfile_Result>).GetEnumerator()). Returns(teamSeasonScheduleProfile.GetEnumerator()); // Do the wiring between DbContext and ObjectResult A.CallTo(() => dbContext.GetTeamSeasonScheduleProfile(A <string> .Ignored, A <int> .Ignored)) .Returns(fakeObjectResult); }
/// <summary> /// Gets the profile of a team's season schedule /// </summary> /// <param name="dbContext">An instance of the ProFootballEntities class</param> /// <param name="teamName">The name of the selected team</param> /// <param name="seasonID">The ID of the selected season</param> /// <returns>The result of the stored procedure execution</returns> public ObjectResult <GetTeamSeasonScheduleProfile_Result> GetTeamSeasonScheduleProfile( ProFootballEntities dbContext, string teamName, int?seasonID) { ObjectResult <GetTeamSeasonScheduleProfile_Result> retVal = null; try { retVal = dbContext.GetTeamSeasonScheduleProfile(teamName, seasonID); } catch (ArgumentException ex) { _log.Error( "Argument exception in StoredProcedureRepository.GetTeamSeasonScheduleProfile: " + ex.Message); } catch (InvalidOperationException ex) { _log.Error("Invalid operation in StoredProcedureRepository.GetTeamSeasonScheduleProfile: " + ex.Message); } return(retVal); }