/// <summary> /// Gets all total rankings for the selected season /// </summary> /// <param name="seasonID">The ID of the selected season</param> /// <returns>The result of the stored procedure execution</returns> public ObjectResult <GetRankingsTotal_Result> GetRankingsTotal(int?seasonID) { try { return(_dbContext.GetRankingsTotal(seasonID)); } catch (Exception ex) { _log.Error(ex.Message); throw; } }
public static void SetUpFakeRankingsTotal(this ProFootballEntities dbContext, IEnumerable <GetRankingsTotal_Result> totalRankingsEnumerable = null) { if (totalRankingsEnumerable == null) { totalRankingsEnumerable = new List <GetRankingsTotal_Result>(); } var totalRankingsQueryable = totalRankingsEnumerable.AsQueryable(); var fakeObjectResult = A.Fake <ObjectResult <GetRankingsTotal_Result> >(d => d.Implements(typeof(IEnumerable <GetRankingsTotal_Result>))); // Setup all IEnumerable methods using what you have from "seasonStandings" A.CallTo(() => (fakeObjectResult as IEnumerable <GetRankingsTotal_Result>).GetEnumerator()) .Returns(totalRankingsQueryable.GetEnumerator()); // Do the wiring between DbContext and ObjectResult A.CallTo(() => dbContext.GetRankingsTotal(A <int> .Ignored)).Returns(fakeObjectResult); }