/// <summary> /// Gets all defensive 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 <GetRankingsDefensive_Result> GetRankingsDefensive(int?seasonID) { try { return(_dbContext.GetRankingsDefensive(seasonID)); } catch (Exception ex) { _log.Error(ex.Message); throw; } }
public static void SetUpFakeRankingsDefensive(this ProFootballEntities dbContext, IEnumerable <GetRankingsDefensive_Result> defensiveRankingsEnumerable = null) { if (defensiveRankingsEnumerable == null) { defensiveRankingsEnumerable = new List <GetRankingsDefensive_Result>(); } var defensiveRankingsQueryable = defensiveRankingsEnumerable.AsQueryable(); var fakeObjectResult = A.Fake <ObjectResult <GetRankingsDefensive_Result> >(d => d.Implements(typeof(IEnumerable <GetRankingsDefensive_Result>))); // Setup all IEnumerable methods using what you have from "seasonStandings" A.CallTo( () => (fakeObjectResult as IEnumerable <GetRankingsDefensive_Result>).GetEnumerator()) .Returns(defensiveRankingsQueryable.GetEnumerator()); // Do the wiring between DbContext and ObjectResult A.CallTo(() => dbContext.GetRankingsDefensive(A <int> .Ignored)).Returns(fakeObjectResult); }