public async Task ArchiveLogFilesByCategory_ExecuteLessThan5Seconds(string startTime, string endTime, string category, long expectedMaxExecutionTime) { // Arrange var archiveModel = new ArchiveModel(); archiveModel.StartDate = startTime; archiveModel.EndDate = endTime; archiveModel.Category = category; IArchiveManager archiveManager = new ArchiveManager(archiveService, folderHandlerService); ArchiveController archiveController = new ArchiveController(archiveManager); // Act var timer = Stopwatch.StartNew(); var actualResult = await archiveController.ArchiveLogFilesByCategory(archiveModel); timer.Stop(); var actualExecutionTime = timer.ElapsedMilliseconds; Debug.WriteLine("Actual Execution Time: " + actualExecutionTime); // Assert Assert.IsTrue(actualExecutionTime <= expectedMaxExecutionTime); }
public async void DeleteFromArchive_return_True() { var context = GetContext(); ItemCategory category = new ItemCategory() { CategoryName = "TestName" }; context.Add(category); context.SaveChanges(); Item TestRecord = new Item() { ItemStorageID = "Архив", ItemName = "Test", ItemArticle = "123-123-123-123", CategoryID = category.CategoryID }; context.Add(TestRecord); context.SaveChanges(); var expected = TestRecord.ItemStorageID; ArchiveController archiveController = new ArchiveController(context); await archiveController.DeleteFromArchive(TestRecord.ItemID); var actual = context.Items.FirstOrDefault(a => a.ItemName == TestRecord.ItemName).ItemStorageID; Assert.DoesNotMatch(expected, actual); }
private void addArchiveToolStripMenuItem_Click(object sender, EventArgs e) { ArchiveController arController = kernel[typeof(ArchiveController)] as ArchiveController; arController.Run(); controller.DatabaseUpdated(); //controller.ArchivesSelected(); }
private void CreateArchiveController() { _archiveController = new ArchiveController(); _archiveController.OnExceptionOccured += ArchiveController_OnExceptionOccured; _archiveController.OnRearchiveStarted += ArchiveController_OnRearchiveStarted; _archiveController.OnRearchiveCompleted += ArchiveController_OnRearchiveCompleted; _archiveController.OnRearchiveOverallStarted += ArchiveController_OnRearchiveOverallStarted; _archiveController.OnRearchiveOverallAborted += ArchiveController_OnRearchiveOverallAborted; _archiveController.OnRearchiveOverallCompleted += ArchiveController_OnRearchiveOverallCompleted; _archiveController.OnProgressChanged += ArchiveController_OnProgressChanged; _archiveController.OnOverallProgressChanged += ArchiveController_OnOverallProgressChanged; }
public async Task GetCategories_ExecuteLessThan5Seconds(long expectedMaxExecutionTime) { // Arrange IArchiveManager archiveManager = new ArchiveManager(archiveService, folderHandlerService); ArchiveController archiveController = new ArchiveController(archiveManager); // Act var timer = Stopwatch.StartNew(); var actualResult = await archiveController.GetCategories(); timer.Stop(); var actualExecutionTime = timer.ElapsedMilliseconds; Debug.WriteLine("Actual Execution Time: " + actualExecutionTime); // Assert Assert.IsTrue(actualExecutionTime <= expectedMaxExecutionTime); }
private void editToolStripMenuItem1_Click(object sender, EventArgs e) { object selectedObject; SelectedNodeType selectedNodeType = GetSelectedNodeObject(out selectedObject); switch (selectedNodeType) { case SelectedNodeType.datasource: DataSourceController dsController = kernel[typeof(DataSourceController)] as DataSourceController; dsController.DataSourceDef = selectedObject as DsDef; dsController.Run(); return; case SelectedNodeType.datasourcearchive: ArchiveController archController = kernel[typeof(ArchiveController)] as ArchiveController; archController.ArchiveDef = selectedObject as ArcDef; archController.Run(); return; } }
private void modifyToolStripMenuItem_Click(object sender, EventArgs e) { object nodeData; SelectedNodeType nodeType = GetSelectedNodeObject(out nodeData); if (nodeType == SelectedNodeType.datasource) { DataSourceController dsController = kernel[typeof(DataSourceController)] as DataSourceController; dsController.DataSourceDef = nodeData as DsDef; DatabaseData srcDatabaseData = GetSrcDatabase(); controller.StartEditDatabase(srcDatabaseData); dsController.SrcDatabase = srcDatabaseData; if (dsController.Run()) { controller.DatabaseUpdated(srcDatabaseData); } return; } if (nodeType == SelectedNodeType.datasourcearchive) { ArchiveController archController = kernel[typeof(ArchiveController)] as ArchiveController; archController.ArchiveDef = nodeData as ArcDef; if (archController.Run()) { controller.DatabaseUpdated(GetSrcDatabase()); } return; } if (nodeType == SelectedNodeType.database) { if (!CheckIfUnsaved()) { return; } controller.StartEditDatabase(nodeData as DatabaseData); } }
/// <summary> /// /// </summary> /// <param name="fonctionality"></param> /// <returns></returns> public override Controllable GetController(string fonctionality, ViewType?viewType = null, EditionMode?editionMode = null) { if (fonctionality == InitiationFunctionalitiesCode.INITIATION_MODEL) { InitiationController initiationController = new InitiationController(); initiationController.ApplicationManager = this.ApplicationManager; initiationController.Service = ((InitiationServiceFactory)ServiceFactory).GetInitiationService(); return(initiationController); } if (fonctionality == InitiationFunctionalitiesCode.INITIATION_PERIOD) { PeriodNameController periodNameController = new PeriodNameController(); periodNameController.ApplicationManager = this.ApplicationManager; periodNameController.Service = ((InitiationServiceFactory)ServiceFactory).GetPeriodNameService(); return(periodNameController); } if (fonctionality == InitiationFunctionalitiesCode.BACKUP_SIMPLE_FUNCTIONALITY) { ArchiveController archiveController = new ArchiveController(); archiveController.ApplicationManager = this.ApplicationManager; archiveController.isSimpleArchive = true; archiveController.fileService = ((InitiationServiceFactory)ServiceFactory).GetFileService(); return(archiveController); } if (fonctionality == InitiationFunctionalitiesCode.BACKUP_AUTOMATIC_FUNCTIONALITY) { ArchiveController archiveController = new ArchiveController(); archiveController.ApplicationManager = this.ApplicationManager; archiveController.isSimpleArchive = false; archiveController.fileService = ((InitiationServiceFactory)ServiceFactory).GetFileService(); return(archiveController); } return(null); }
public ActionResult ArchiveList(int page = 1) { var archive = new ArchiveController(); return archive.Top(); }