public MatchesRssController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ServiceContext serviceContext, AppCaches appCaches, IProfilingLogger profilingLogger, UmbracoHelper umbracoHelper, IClubDataSource clubDataSource, ITeamDataSource teamDataSource, ICompetitionDataSource competitionDataSource, IMatchLocationDataSource matchLocationDataSource, IMatchListingDataSource matchDataSource, IDateTimeFormatter dateFormatter, IMatchesRssQueryStringParser queryStringParser, IMatchFilterHumanizer matchFilterHumanizer) : base(globalSettings, umbracoContextAccessor, serviceContext, appCaches, profilingLogger, umbracoHelper) { _clubDataSource = clubDataSource ?? throw new ArgumentNullException(nameof(clubDataSource)); _teamDataSource = teamDataSource ?? throw new ArgumentNullException(nameof(teamDataSource)); _competitionDataSource = competitionDataSource ?? throw new ArgumentNullException(nameof(competitionDataSource)); _matchLocationDataSource = matchLocationDataSource ?? throw new ArgumentNullException(nameof(matchLocationDataSource)); _matchDataSource = matchDataSource ?? throw new ArgumentNullException(nameof(matchDataSource)); _dateFormatter = dateFormatter ?? throw new ArgumentNullException(nameof(dateFormatter)); _queryStringParser = queryStringParser ?? throw new ArgumentNullException(nameof(queryStringParser)); _matchFilterHumanizer = matchFilterHumanizer ?? throw new ArgumentNullException(nameof(matchFilterHumanizer)); }
public TestController(IMatchListingDataSource matchDataSource, IMatchesRssQueryStringParser queryStringParser, IMatchFilterHumanizer matchFilterHumanizer, UmbracoHelper umbracoHelper) : base( Mock.Of <IGlobalSettings>(), Mock.Of <IUmbracoContextAccessor>(), null, AppCaches.NoCache, Mock.Of <IProfilingLogger>(), umbracoHelper, Mock.Of <IClubDataSource>(), Mock.Of <ITeamDataSource>(), Mock.Of <ICompetitionDataSource>(), Mock.Of <IMatchLocationDataSource>(), matchDataSource, Mock.Of <IDateTimeFormatter>(), queryStringParser, matchFilterHumanizer) { var request = new Mock <HttpRequestBase>(); request.SetupGet(x => x.Url).Returns(new Uri("https://example.org")); request.SetupGet(x => x.RawUrl).Returns("/matches.rss"); request.SetupGet(x => x.QueryString).Returns(HttpUtility.ParseQueryString(string.Empty)); var context = new Mock <HttpContextBase>(); context.SetupGet(x => x.Request).Returns(request.Object); var controllerContext = new Mock <ControllerContext>(); controllerContext.Setup(p => p.HttpContext).Returns(context.Object); controllerContext.Setup(p => p.HttpContext.User).Returns(new GenericPrincipal(new GenericIdentity("test"), null)); ControllerContext = controllerContext.Object; }