public SitemapControllerTests() { defaultPathDataService = A.Fake <IPathDataService>(); defaultLogger = A.Fake <ILogger <SitemapController> >(); defaultBaseUrlService = A.Fake <IBaseUrlService>(); var pathModels = new List <PathModel> { new PathModel { SitemapURL = "http://SomeSitemapUrl.xyz", IsOnline = true, }, }; A.CallTo(() => defaultPathDataService.GetPaths()).Returns(pathModels); var user = A.Fake <ClaimsPrincipal>(); A.CallTo(() => user.Identity.IsAuthenticated).Returns(true); defaultHttpContext = A.Fake <HttpContext>(); defaultHttpContext.Request.Scheme = DummyScheme; defaultHttpContext.Request.Host = new HostString(DummyHost); var fakeIdentity = new GenericIdentity("User"); var principal = new GenericPrincipal(fakeIdentity, null); A.CallTo(() => defaultHttpContext.User).Returns(principal); defaultUrlHelper = A.Fake <IUrlHelper>(); A.CallTo(() => defaultUrlHelper.Action(A <UrlActionContext> .Ignored)).Returns(DummyHomeIndex); defaultTokenRetriever = A.Fake <IBearerTokenRetriever>(); A.CallTo(() => defaultTokenRetriever.GetToken(A <HttpContext> .Ignored)).Returns("SomeToken"); A.CallTo(() => defaultBaseUrlService.GetBaseUrl(A <HttpRequest> .Ignored, A <IUrlHelper> .Ignored)) .Returns("http://SomeBaseUrl"); defaultSitemapService = A.Fake <IApplicationSitemapService>(); A.CallTo(() => defaultSitemapService.GetAsync(A <ApplicationSitemapModel> .Ignored)) .Returns(Task.FromResult <IEnumerable <SitemapLocation> >(new List <SitemapLocation>() { new SitemapLocation { Url = "http://Sitemap.xml", Priority = 1, }, })); defaultController = new SitemapController(defaultPathDataService, defaultLogger, defaultTokenRetriever, defaultBaseUrlService, defaultSitemapService) { ControllerContext = new ControllerContext { HttpContext = defaultHttpContext, }, Url = defaultUrlHelper, }; }
public HealthControllerTests() { appRegistryDataService = A.Fake <IAppRegistryDataService>(); logger = A.Fake <ILogger <HealthController> >(); bearerTokenRetriever = A.Fake <IBearerTokenRetriever>(); applicationHealthService = A.Fake <IApplicationHealthService>(); healthController = new HealthController(appRegistryDataService, logger, bearerTokenRetriever, applicationHealthService); }
public HealthControllerTests() { pathDataService = A.Fake <IPathDataService>(); regionService = A.Fake <IRegionService>(); logger = A.Fake <ILogger <HealthController> >(); bearerTokenRetriever = A.Fake <IBearerTokenRetriever>(); applicationHealthService = A.Fake <IApplicationHealthService>(); healthController = new HealthController(pathDataService, regionService, logger, bearerTokenRetriever, applicationHealthService); }
public HealthController( IAppRegistryDataService appRegistryDataService, ILogger <HealthController> logger, IBearerTokenRetriever bearerTokenRetriever, IApplicationHealthService applicationHealthService) { this.appRegistryDataService = appRegistryDataService; this.logger = logger; this.bearerTokenRetriever = bearerTokenRetriever; this.applicationHealthService = applicationHealthService; }
public RobotControllerTests() { defaultAppRegistryDataService = A.Fake <IAppRegistryDataService>(); defaultLogger = A.Fake <ILogger <RobotController> >(); defaultWebHostEnvironment = A.Fake <IWebHostEnvironment>(); defaultBaseUrlService = A.Fake <IBaseUrlService>(); var appRegistrationModels = new List <AppRegistrationModel> { new AppRegistrationModel { RobotsURL = new Uri("http://SomeRobotUrl.xyz", UriKind.Absolute), IsOnline = true, }, }; A.CallTo(() => defaultAppRegistryDataService.GetAppRegistrationModels()).Returns(appRegistrationModels); var user = A.Fake <ClaimsPrincipal>(); A.CallTo(() => user.Identity.IsAuthenticated).Returns(true); defaultHttpContext = A.Fake <HttpContext>(); defaultHttpContext.Request.Scheme = DummyScheme; defaultHttpContext.Request.Host = new HostString(DummyHost); var fakeIdentity = new GenericIdentity("User"); var principal = new GenericPrincipal(fakeIdentity, null); A.CallTo(() => defaultHttpContext.User).Returns(principal); defaultUrlHelper = A.Fake <IUrlHelper>(); A.CallTo(() => defaultUrlHelper.Content(A <string> .Ignored)).Returns("DummyUrl"); A.CallTo(() => defaultUrlHelper.RouteUrl(A <UrlRouteContext> .Ignored)).Returns(DummySitemapUrl); defaultTokenRetriever = A.Fake <IBearerTokenRetriever>(); A.CallTo(() => defaultTokenRetriever.GetToken(A <HttpContext> .Ignored)).Returns("SomeToken"); defaultApplicationRobotService = A.Fake <IApplicationRobotService>(); A.CallTo(() => defaultApplicationRobotService.GetAsync(A <ApplicationRobotModel> .Ignored)).Returns("RetrievedValue: SomeValue"); defaultShellRobotFileService = A.Fake <IShellRobotFileService>(); A.CallTo(() => defaultShellRobotFileService.GetStaticFileText(A <string> .Ignored)).Returns("{Insertion}"); defaultController = new RobotController(defaultAppRegistryDataService, defaultLogger, defaultWebHostEnvironment, defaultTokenRetriever, defaultApplicationRobotService, defaultShellRobotFileService, defaultBaseUrlService) { ControllerContext = new ControllerContext { HttpContext = defaultHttpContext, }, Url = defaultUrlHelper, }; }
public SitemapController( IPathDataService pathDataService, ILogger <SitemapController> logger, IBearerTokenRetriever bearerTokenRetriever, IBaseUrlService baseUrlService, IApplicationSitemapService sitemapService) { this.pathDataService = pathDataService; this.logger = logger; this.bearerTokenRetriever = bearerTokenRetriever; this.baseUrlService = baseUrlService; this.sitemapService = sitemapService; }
public HealthController( IPathDataService pathDataService, IRegionService regionService, ILogger<HealthController> logger, IBearerTokenRetriever bearerTokenRetriever, IApplicationHealthService applicationHealthService) { this.pathDataService = pathDataService; this.regionService = regionService; this.logger = logger; this.bearerTokenRetriever = bearerTokenRetriever; this.applicationHealthService = applicationHealthService; }
public RobotController( IAppRegistryDataService appRegistryDataService, ILogger <RobotController> logger, IWebHostEnvironment webHostEnvironment, IBearerTokenRetriever bearerTokenRetriever, IApplicationRobotService applicationRobotService, IShellRobotFileService shellRobotFileService, IBaseUrlService baseUrlService) { this.appRegistryDataService = appRegistryDataService; this.logger = logger; this.webHostEnvironment = webHostEnvironment; this.bearerTokenRetriever = bearerTokenRetriever; this.applicationRobotService = applicationRobotService; this.shellRobotFileService = shellRobotFileService; this.baseUrlService = baseUrlService; }