/// <summary> /// Gets the totals 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 <GetTeamSeasonScheduleTotals_Result> GetTeamSeasonScheduleTotals(string teamName, int?seasonID) { try { return(_dbContext.GetTeamSeasonScheduleTotals(teamName, seasonID)); } catch (ArgumentException ex) { _log.Error($"Argument exception in StoredProcedureRepository.GetTeamSeasonScheduleTotals: {ex.Message}"); throw; } catch (InvalidOperationException ex) { _log.Error($"Invalid operation in StoredProcedureRepository.GetTeamSeasonScheduleTotals: {ex.Message}"); throw; } catch (Exception ex) { _log.Error(ex.Message); throw; } }
public static void SetUpFakeTeamSeasonScheduleTotals(this ProFootballEntities dbContext, IEnumerable <GetTeamSeasonScheduleTotals_Result> teamSeasonScheduleTotals = null) { var fakeObjectResult = A.Fake <ObjectResult <GetTeamSeasonScheduleTotals_Result> >(d => d.Implements(typeof(IEnumerable <GetTeamSeasonScheduleTotals_Result>))); // Setup all IEnumerable methods using what you have from "fakeObjectResult" A.CallTo(() => (fakeObjectResult as IEnumerable <GetTeamSeasonScheduleTotals_Result>).GetEnumerator()) .Returns(teamSeasonScheduleTotals.GetEnumerator()); // Do the wiring between DbContext and ObjectResult A.CallTo(() => dbContext.GetTeamSeasonScheduleTotals(A <string> .Ignored, A <int> .Ignored)) .Returns(fakeObjectResult); }
/// <summary> /// Gets the totals 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 <GetTeamSeasonScheduleTotals_Result> GetTeamSeasonScheduleTotals( ProFootballEntities dbContext, string teamName, int?seasonID) { ObjectResult <GetTeamSeasonScheduleTotals_Result> retVal = null; try { retVal = dbContext.GetTeamSeasonScheduleTotals(teamName, seasonID); } catch (ArgumentException ex) { _log.Error("Argument exception in StoredProcedureRepository.GetTeamSeasonScheduleTotals: " + ex.Message); } catch (InvalidOperationException ex) { _log.Error("Invalid operation in StoredProcedureRepository.GetTeamSeasonScheduleTotals: " + ex.Message); } return(retVal); }