public void TestInitialize() { this.logger = new Mock <ILogger <FileUploadController> >(); this.fileUploadProvider = new Mock <IFileUploadProvider>(); this.telemetryClient = new TelemetryClient(new TelemetryConfiguration()); this.controller = new FileUploadController(this.fileUploadProvider.Object, this.logger.Object, this.telemetryClient); this.fromFile = new FormFile(new MemoryStream(Encoding.UTF8.GetBytes("This is a dummy file")), 0, 0, "Data", FileName); // Mock behaviour of the UploadFileAsync method this.fileUploadProvider.Setup(x => x.UploadFileAsync(It.IsAny <string>(), It.IsAny <Stream>(), It.IsAny <string>())).Returns(Task.FromResult(BlobUri)); this.controller.ControllerContext = new ControllerContext { HttpContext = FakeHttpContext.GetMockHttpContextWithUserClaims(), }; }
public void TestInitialize() { this.logger = new Mock <ILogger <TabConfigurationController> >(); this.telemetryClient = new TelemetryClient(new TelemetryConfiguration()); this.unitOfWork = new Mock <IUnitOfWork>(); this.tabConfigurationController = new TabConfigurationController( this.logger.Object, this.telemetryClient, this.unitOfWork.Object) { ControllerContext = new ControllerContext { HttpContext = FakeHttpContext.GetMockHttpContextWithUserClaims(), }, }; }
public void TestInitialize() { this.logger = new Mock <ILogger <UserResourceController> >(); this.telemetryClient = new TelemetryClient(new TelemetryConfiguration()); this.unitOfWork = new Mock <IUnitOfWork>(); this.resourceMapper = new Mock <IResourceMapper>(); this.usersServiceMock = new Mock <IUsersService>(); this.accessTokenHelper = new FakeAccessTokenHelper(); this.userResourceController = new UserResourceController( this.logger.Object, this.telemetryClient, this.unitOfWork.Object, this.usersServiceMock.Object, this.resourceMapper.Object) { ControllerContext = new ControllerContext(), }; this.userResourceController.ControllerContext.HttpContext = FakeHttpContext.GetMockHttpContextWithUserClaims(); }
public void TestInitialize() { this.logger = new Mock <ILogger <FileDownloadController> >(); this.fileDownloadProvider = new Mock <IFileDownloadProvider>(); this.unitOfWork = new Mock <IUnitOfWork>(); this.telemetryClient = new TelemetryClient(new TelemetryConfiguration()); this.controller = new FileDownloadController( this.unitOfWork.Object, this.fileDownloadProvider.Object, this.telemetryClient, this.logger.Object); // Mock behavior of the GetDownloadUri method this.fileDownloadProvider.Setup(x => x.GetDownloadUriAsync(It.IsAny <string>())).ReturnsAsync(TempUri + TempToken); this.controller.ControllerContext = new ControllerContext { HttpContext = FakeHttpContext.GetMockHttpContextWithUserClaims(), }; this.resourceRepository = new Mock <IResourceRepository>(); }
public void TestInitialize() { this.logger = new Mock <ILogger <ImageController> >(); this.previewImagesHelper = new Mock <IImageProviderService>(); TelemetryConfiguration mockTelemetryConfig = new TelemetryConfiguration(); this.telemetryClient = new TelemetryClient(mockTelemetryConfig); this.imageController = new ImageController(this.previewImagesHelper.Object, this.logger.Object, this.telemetryClient); this.bingSearchResult = new List <string>() { "https://test/natureImage1.jpg", "https://test/natureImage2.jpg", "https://test/natureImage3.jpg", "https://test/natureImage4.jpg", }; // Mock behaviour of the GetSearchResultAsync method. this.previewImagesHelper.Setup(x => x.GetSearchResultAsync(It.IsAny <string>())).Returns(Task.FromResult(this.bingSearchResult)); this.imageController.ControllerContext = new ControllerContext(); this.imageController.ControllerContext.HttpContext = FakeHttpContext.GetMockHttpContextWithUserClaims(); }