protected override void OnActivated() { base.OnActivated(); exportController = Frame.GetController <ExportController>(); exportController.CustomGetDefaultFileName += exportController_CustomGetDefaultFileName; exportController.CustomExport += new EventHandler <CustomExportEventArgs>(CustomExport); }
public async Task GetReturnsProfileForSpecifiedIdTest() { var account = Model.Create <Account>(); var profile = Model.Create <ExportProfile>(); var user = ClaimsIdentityFactory.BuildPrincipal(account); var query = Substitute.For <IExportQuery>(); var httpContext = Substitute.For <HttpContext>(); httpContext.User = user; var routerData = new RouteData(); var actionDescriptor = new ControllerActionDescriptor(); var actionContext = new ActionContext(httpContext, routerData, actionDescriptor); var controllerContext = new ControllerContext(actionContext); using (var tokenSource = new CancellationTokenSource()) { query.GetExportProfile(account.Id, tokenSource.Token).Returns(profile); using (var target = new ExportController(query)) { target.ControllerContext = controllerContext; var actual = await target.Get(tokenSource.Token).ConfigureAwait(false); actual.Should().BeOfType <OkObjectResult>(); var result = actual.As <OkObjectResult>(); result.Value.Should().BeEquivalentTo(profile); } } }
public void Display() { EditorGUILayout.LabelField("", GUI.skin.horizontalSlider); if (GUILayout.Button("Play Level")) { AvatarController.CreateAvatar(0.0f, 0.0f); EditorApplication.ExecuteMenuItem("Edit/Play"); } if (GUILayout.Button("Stop Level")) { if (Application.isPlaying) { EditorApplication.ExecuteMenuItem("Edit/Play"); } AvatarController.RemoveAvatar(); } if (GUILayout.Button("Export Level")) { string sceneName = SceneManager.GetActiveScene().name; ExportController.ExportFile(sceneName); } }
public async Task GetReturnsNotFoundWhenQueryReturnsNullTest() { var account = Model.Create <Account>(); var user = ClaimsIdentityFactory.BuildPrincipal(account); var query = Substitute.For <IExportQuery>(); var httpContext = Substitute.For <HttpContext>(); httpContext.User = user; var routerData = new RouteData(); var actionDescriptor = new ControllerActionDescriptor(); var actionContext = new ActionContext(httpContext, routerData, actionDescriptor); var controllerContext = new ControllerContext(actionContext); using (var tokenSource = new CancellationTokenSource()) { using (var target = new ExportController(query)) { target.ControllerContext = controllerContext; var actual = await target.Get(tokenSource.Token).ConfigureAwait(false); actual.Should().BeOfType <ErrorMessageResult>().Which.StatusCode.Should().Be((int)HttpStatusCode.NotFound); } } }
public ExportController_Tests(ExportControllerFixture fixture) { Fixture = fixture; Fixture.ClearInvocations(); Controller = Fixture.Controller; Controller.Url = Fixture.UrlHelperMock.Object; }
public HttpResponseMessage Export(ExportDto exportDto) { var controller = new ExportController(); var jobId = controller.QueueOperation(this.PortalSettings.UserId, exportDto); return(this.Request.CreateResponse(HttpStatusCode.OK, new { jobId })); }
public ExportControllerTests() { _fixture = new Fixture(); _pageRepositoryMock = Substitute.For <IPageRepository>(); _exportController = new ExportController(_pageRepositoryMock); }
public void export_as_csv_sanity_check() { var controller = new ExportController(new RecordQueryer(Db)); var input = new RecordQueryInputModel { Q = "", F = new FilterOptions { Keywords = new[] { "vocab.jncc.gov.uk/jncc-category/Seabed Habitat Maps" } }, P = 0, N = -1 }; var result = controller.Get(input, "CSV"); var task = (PushStreamContent)result.Content; var content = task.ReadAsStringAsync().Result; content.Should().NotBeNullOrWhiteSpace(); var matches = Regex.Matches(content, @"""""Value"""":""""GB\d{6}"""""); // match a mesh identifier e.g. GB000272 matches.Count.Should().Be(189); // the number of mesh records }
public ExportControllerTests() { _exportEnabledController = GetController(new ExportJobConfiguration() { Enabled = true }); }
static void Main(string[] args) { Document document = new Document(); Exporter exporter = new CSVExporter(); ExportController exportController = new ExportController(exporter); exportController.RunExport(document); }
// Use this for initialization void Start() { copyGC = gridObject.GetComponent<GridController>(); copyVS = vertexSpawnerObject.GetComponent<VertexSpawner>(); copySC = selectorControllerObject.GetComponent<SelectorController>(); copyGG = cameraObject.GetComponent<GloblGUI>(); copyEC = cameraObject.GetComponent<ExportController>(); }
private void button_ExportToFichier_Click(object sender, EventArgs e) { ExportController ExportController = new ExportController(); this.progressBar.Visible = true; ExportController.WriteFile(FilePath, this); this.Close(); }
protected override void OnActivated() { base.OnActivated(); exportController = Frame.GetController <ExportController>(); if (exportController != null) { exportController.CustomGetDefaultFileName += exportController_CustomGetDefaultFileName; } }
public void ExportObj() { var savePath = StandaloneFileBrowser.SaveFilePanel("Save Model", "", "myObject.obj", "obj"); if (savePath != "") { ExportController.Export(savePath, ModelManager.GetCompleteMesh()); } }
private void FrmExportPicture_Load(object sender, EventArgs e) { var setting = SettingController.Setting; controller = ExportController.Create(setting); controller.ExportedOneFile += ExportController_ExportedOneFile; controller.WillExportFile += Controller_WillExportFile; InitComboBoxData(setting); }
private static ExportController SetUp( Mock <IExportService> service = null, Mock <ILogger <ExportController> > logger = null) { service = service ?? new Mock <IExportService>(); logger = logger ?? new Mock <ILogger <ExportController> >(); var controller = new ExportController(logger.Object, service.Object); return(controller); }
public void ExportController_ZipNotFound() { var storage = new StorageSubPathFilesystem(_appSettings, new FakeIWebLogger()); var selectorStorage = new FakeSelectorStorage(storage); var export = new ExportService(_query, _appSettings, selectorStorage, new FakeIWebLogger()); var controller = new ExportController(_bgTaskQueue, selectorStorage, export); controller.ControllerContext.HttpContext = new DefaultHttpContext(); var actionResult = controller.Status("____fail", true) as NotFoundObjectResult; Assert.AreEqual(404, actionResult.StatusCode); }
public void Ctor_WithBlogMLSource_SetsSource() { // arrange var source = new Mock <IBlogMLSource>(); // act var controller = new ExportController(source.Object, new Blog { Title = "whatever" }); // assert Assert.AreEqual(source.Object, controller.Source); }
private void Form_OnExportData(object sender, ResultEventArgs e) { if (this._exporters.Count > 1) { var ttl = "Exporters"; var msg = "Select the target to export data to."; var frm = new SelectForm(ttl, msg, this._exporters.Keys.Select(x => x.ToString())); var result = frm.ShowDialog(); if (result != DialogResult.OK) { return; } ControllerType type; if (Enum.TryParse(frm.SelectedItems[0], out type)) { this._selectedExporter = this._exporters[type]; } } if (this._selectedExporter == null) { return; } string target; switch (this._selectedExporter.Type) { case ControllerType.EXCEL: SaveFileDialog dialog = new SaveFileDialog { Filter = "Excel Files|*.xlsx" }; if (dialog.ShowDialog() != DialogResult.OK) { return; } target = dialog.FileName; break; //case ControllerType.JSON: // break; //case ControllerType.SQL: // break; default: throw new ArgumentOutOfRangeException(); } //e.Result = this._controller.ExportData(this._selectedExporter, target); }
protected override void OnActivated() { base.OnActivated(); ExportController controller = Frame.GetController <ExportController>(); if (controller != null) { controller.ExportAction.Executing += ExportAction_Executing; if (SecuritySystem.Instance is IRequestSecurity) { controller.Active.SetItemValue("Security", SecuritySystem.IsGranted(new ExportPermissionRequest())); } } }
public FormMain() { InitializeComponent(); this.FamilleNames = new List <string>(); this.SousFamilleNames = new List <string>(); this.MarqueNames = new List <string>(); ArticlesController = new ArticlesController(); ExportController = new ExportController(); ImportController = new ImportController(); ModelListController = new ModelListController(); SousFamilleController = new SousFamilleController(); MarqueController = new MarqueController(); FamilleController = new FamilleController(); }
public void ExportBlogML_WithBlogTitleHavingIllegalFileNameCharacters_RemovesThoseCharactersFromFileDownloadName() { // arrange var source = new Mock <IBlogMLSource>(); var controller = new ExportController(source.Object, new Blog { Title = @"whatever \|/ you say" }); // act var result = controller.BlogML(false /*embedAttachments*/) as ExportActionResult; // assert Assert.AreEqual("whatever you say-Export.xml", result.FileDownloadName); }
public void ExportBlogML_WithBlogTitle_SetsFileDownloadNameToTitle() { // arrange var source = new Mock <IBlogMLSource>(); var controller = new ExportController(source.Object, new Blog { Title = "whatever" }); // act var result = controller.BlogML(false /*embedAttachments*/) as ExportActionResult; // assert Assert.AreEqual("whatever-Export.xml", result.FileDownloadName); }
/// <summary> /// The application entry point. /// </summary> /// <param name="args"> /// The command line arguments. /// </param> static void Main(string[] args) { // INITIALISE an IReadController, IWriteController, IFilterController, IReportController as their respective // concrete implementations, ReadController, WriteController, FilterController and ReportController IReadController readController = new ReadController(); IWriteController writeController = new WriteController(); IFilterController filterController = new FilterController(); IReportController reportController = new ReportController(); // INITIALISE an IExportController as ExportController, passing in the readController and WriteController IExportController conversationExporter = new ExportController(readController, writeController, filterController, reportController); ConversationExporterConfiguration configuration = new CommandLineArgumentParser().ParseCommandLineArguments(args, filterController); conversationExporter.ExportConversation(configuration.inputFilePath, configuration.outputFilePath); }
protected override void OnDeactivated() { // Unsubscribe from previously subscribed events and release other references and resources. if (exportCtrl != null) { exportCtrl.Active.RemoveItem(Key); exportCtrl = null; } if (webExportCtrl != null) { webExportCtrl.Active.RemoveItem(Key); webExportCtrl = null; } base.OnDeactivated(); }
/// <summary> /// Initializes a new instance of the <see cref="DraftNotificationsController"/> class. /// </summary> private ExportController GetControllerInstance() { var controller = new ExportController(this.sentNotificationDataRepository.Object, this.exportDataRepository.Object, this.userDataRepository.Object, this.exportQueue.Object, this.memberService.Object, this.teamDataRepository.Object, this.appSettingsService.Object); var user = new ClaimsPrincipal(new ClaimsIdentity( new Claim[] { new Claim(Common.Constants.ClaimTypeTenantId, this.claimTypeTenantId), new Claim(Common.Constants.ClaimTypeUserId, this.claimTypeUserId), }, "mock")); controller.ControllerContext = new ControllerContext(); controller.ControllerContext.HttpContext = new DefaultHttpContext { User = user }; return(controller); }
public void ExportBlogML_WithEmbedAttachmentsFalse_ReturnsExportActionResultWithEmbedFalse() { // arrange var source = new Mock <IBlogMLSource>(); var controller = new ExportController(source.Object, new Blog { Title = "whatever" }); // act var result = controller.BlogML(false /*embedAttachments*/) as ExportActionResult; // assert var writer = result.BlogMLWriter as BlogMLWriter; Assert.IsFalse(writer.EmbedAttachments); }
public async Task Then_Sends_GetStandardsListQuery_To_Mediator( [Frozen] Mock <IMediator> mockMediator, GetStandardsListResult queryResult, [Greedy] ExportController controller) { mockMediator.Setup(mediator => mediator.Send( It.Is <GetStandardsListQuery>(query => query.Filter.Equals(StandardFilter.None)), It.IsAny <CancellationToken>())) .ReturnsAsync(queryResult); var controllerResult = await controller.Index() as ObjectResult; controllerResult.StatusCode.Should().Be((int)HttpStatusCode.OK); mockMediator.Verify(x => x.Send(It.IsAny <GetStandardsListQuery>(), It.IsAny <CancellationToken>()), Times.Once); var model = controllerResult.Value as GetStandardsExportResponse; model.Standards.Should().BeEquivalentTo(queryResult.Standards); }
protected override void OnActivated() { base.OnActivated(); ListViewController controller = Frame.GetController <ListViewController>(); if (controller != null) { controller.EditAction.Caption = "Editar"; } ExportController controller2 = Frame.GetController <ExportController>(); if (controller2 != null) { controller2.ExportAction.Caption = "Exportar"; } }
public async Task <MemoryStream> GetFileAs(int id, bool id2) { string authHeader = Request.Headers["authentication"]; string[] auths = authHeader.Split(','); IdentityUser me = await _userManager.FindByIdAsync(auths[1]); UserData appMe = await _context.UserData.SingleAsync(p => p.UserId == me.Id); if (String.Compare(auths[2], appMe.MyGuid, StringComparison.Ordinal) != 0) { return(null); } string userID = auths[1]; NoteAccess myAcc = await AccessManager.GetAccess(_context, userID, id, 0); //TODO if (!myAcc.ReadAccess) { return(null); } ExportController myExp = new ExportController(_appEnv, _userManager, _signInManager, _context); Notes2021.Models.ExportViewModel model = new Notes2021.Models.ExportViewModel(); NoteFile nf = await NoteDataManager.GetFileById(_context, id); model.NoteOrdinal = 0; model.FileName = nf.NoteFileName; model.FileNum = nf.Id; model.directOutput = true; model.isCollapsible = id2; model.isHtml = id2; IdentityUser applicationUser = await _userManager .FindByEmailAsync(auths[0]); await _signInManager.SignInAsync(applicationUser, false); model.tzone = _context.TZone.Single(p => p.Id == appMe.TimeZoneID); return(await myExp.DoExport(model, User, 0)); //TODO }
public void ExportingConversationExportsConversation() { // INITIALISE the ExportController for testing IExportController exporter = new ExportController(new ReadController(), new WriteController(), new FilterController(), new ReportController()); exporter.ExportConversation("chat.txt", "chat.json"); var serializedConversation = new StreamReader(new FileStream("chat.json", FileMode.Open)).ReadToEnd(); var savedConversation = JsonConvert.DeserializeObject <Conversation>(serializedConversation); Assert.That(savedConversation.Name, Is.EqualTo("My Conversation")); var messages = savedConversation.Messages.ToList(); Assert.That(messages[0].Timestamp, Is.EqualTo(DateTimeOffset.FromUnixTimeSeconds(1448470901))); Assert.That(messages[0].SenderId, Is.EqualTo("bob")); Assert.That(messages[0].Content, Is.EqualTo("Hello there!")); Assert.That(messages[1].Timestamp, Is.EqualTo(DateTimeOffset.FromUnixTimeSeconds(1448470905))); Assert.That(messages[1].SenderId, Is.EqualTo("mike")); Assert.That(messages[1].Content, Is.EqualTo("how are you?")); Assert.That(messages[2].Timestamp, Is.EqualTo(DateTimeOffset.FromUnixTimeSeconds(1448470906))); Assert.That(messages[2].SenderId, Is.EqualTo("bob")); Assert.That(messages[2].Content, Is.EqualTo("I'm good thanks, do you like pie?")); Assert.That(messages[3].Timestamp, Is.EqualTo(DateTimeOffset.FromUnixTimeSeconds(1448470910))); Assert.That(messages[3].SenderId, Is.EqualTo("mike")); Assert.That(messages[3].Content, Is.EqualTo("no, let me ask Angus...")); Assert.That(messages[4].Timestamp, Is.EqualTo(DateTimeOffset.FromUnixTimeSeconds(1448470912))); Assert.That(messages[4].SenderId, Is.EqualTo("angus")); Assert.That(messages[4].Content, Is.EqualTo("Hell yes! Are we buying some pie?")); Assert.That(messages[5].Timestamp, Is.EqualTo(DateTimeOffset.FromUnixTimeSeconds(1448470914))); Assert.That(messages[5].SenderId, Is.EqualTo("bob")); Assert.That(messages[5].Content, Is.EqualTo("No, just want to know if there's anybody else in the pie society...")); Assert.That(messages[6].Timestamp, Is.EqualTo(DateTimeOffset.FromUnixTimeSeconds(1448470915))); Assert.That(messages[6].SenderId, Is.EqualTo("angus")); Assert.That(messages[6].Content, Is.EqualTo("YES! I'm the head pie eater there...")); }
// Use this for initialization void Start() { LoadPrefs(); isGridButton = true; isSelectButton = true; isMoveButton = false; isRotateButton = false; isBridgeButton = false; paramsButtonZone = new Rect(padding, padding, squareSize, squareSize); showGridButton = new Rect(padding, squareSize + 2*padding, squareSize, squareSize); newVertexRect = new Rect(padding, 2*(squareSize + padding) + padding, squareSize, squareSize); selectButtonZone = new Rect(padding, 3 * (squareSize + padding) + padding, squareSize, squareSize); moveButtonZone = new Rect(padding, 4 * (squareSize + padding) + padding, squareSize, squareSize); rotateButtonZone = new Rect(padding, 5 * (squareSize + padding) + padding, squareSize, squareSize); bridgeButtonZone = new Rect(padding, 6 * (squareSize + padding) + padding, squareSize, squareSize); clearButtonZone = new Rect(padding, 7 * (squareSize + padding) + padding, squareSize, squareSize); exportButtonZone = new Rect(padding, 8 * (squareSize + padding) + padding, squareSize, squareSize); moveMenusZone = new Rect(Screen.width - 3*padding - valueLength - contentLength, padding, 2*padding + valueLength + contentLength, titleHeight + 4*padding + 3*valueHeight); rotateMenusZone = new Rect(Screen.width - 3 * padding - valueLength - contentLength, padding, 2 * padding + valueLength + contentLength, titleHeight + 4 * padding + 3 * valueHeight); moveRotateTitleZone = new Rect(0, 0, moveMenusZone.width, titleHeight);//relative moveRotateContentZone = new Rect(padding, padding + moveRotateTitleZone.height, moveMenusZone.width - 2*padding, 2*padding + 3*valueHeight); StatusLineZone = new Rect(0, Screen.height - statusHeight, Screen.width, statusHeight); allScreenZone = new Rect(0, 0, Screen.width, Screen.height); paramsWindowZone = new Rect((Screen.width - paramsWindowWidth)/2, (Screen.height - paramsWindowHeight)/2, paramsWindowWidth, paramsWindowHeight); //closeParamsWindowButtonZone = new Rect(paramsWindowZone.xMax - closeButtonSize / 2, paramsWindowZone.yMin - closeButtonSize / 2, closeButtonSize, closeButtonSize); closeParamsWindowButtonZone = new Rect(paramsWindowZone.xMax, paramsWindowZone.yMin - closeButtonSize, closeButtonSize, closeButtonSize); toolbarZone = new Rect(0, 0, paramsWindowZone.width, toolbarHeight);//relative //settingsContentZone = new Rect(padding, padding + toolbarHeight, paramsWindowZone.width - 2*padding, paramsWindowZone.height - 2 * padding - toolbarHeight);//relative settingsContentZoneCentered = new Rect((paramsWindowZone.width - (float)centerZoneWidth) / 2, padding + toolbarHeight,centerZoneWidth, paramsWindowZone.height - 2 * padding - toolbarHeight); copyGC = gridObject.GetComponent<GridController>(); copyVS = vertexSpawnerObject.GetComponent<VertexSpawner>(); copySC = selectorObject.GetComponent<SelectorController>(); copyEC = gameObject.GetComponent<ExportController>(); paramsContentC = new GUIContent(paramsImgC); paramsContentG = new GUIContent(paramsImgG); xContentG = new GUIContent(xImgG); xContentC = new GUIContent(xImgC); gridContentC = new GUIContent(gridImgC); gridContentG = new GUIContent(gridImgG); selectContentC = new GUIContent(selectImgC); selectContentG = new GUIContent(selectImgG); moveContentC = new GUIContent(moveImgC); moveContentG = new GUIContent(moveImgG); rotateContentC = new GUIContent(rotateImgC); rotateContentG = new GUIContent(rotateImgG); bridgeContentC = new GUIContent(bridgeImgC); bridgeContentG = new GUIContent(bridgeImgG); vertexContentC = new GUIContent(vertexImgC); vertexContentG = new GUIContent(vertexImgG); clearContentC = new GUIContent(clearImgC); clearContentG = new GUIContent(clearImgG); exportContentC = new GUIContent(exportImgC); exportContentG = new GUIContent(exportImgG); keyString = FormKeyString(); paramsCameraSpeed = GlobalParameters.cameraSpeed / 8.0f; paramsMoveStep = GlobalParameters.moveStep; paramsRotateStep = GlobalParameters.rotateStep; paramsGridSize = GlobalParameters.gridSize; copyGC.SetSize(paramsGridSize); paramCurveStep = GlobalParameters.curveSteps; paramUseImgEffect = GlobalParameters.useImgEffect; paramLightining = GlobalParameters.lightining; paramBloomIntensity = GlobalParameters.bloomIntensity; paramUseAntialiasing = GlobalParameters.useAntialiasing; paramUseSSAO = GlobalParameters.useSSAO; gameObject.GetComponent<CameraController>().LoadParameters(); copyVS.UpdateBridgeCurveSteps(); }