コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        private void addArchiveToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ArchiveController arController = kernel[typeof(ArchiveController)] as ArchiveController;

            arController.Run();
            controller.DatabaseUpdated();
            //controller.ArchivesSelected();
        }
コード例 #4
0
 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;
 }
コード例 #5
0
        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);
        }
コード例 #6
0
        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;
            }
        }
コード例 #7
0
        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);
            }
        }
コード例 #8
0
        /// <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);
        }
コード例 #9
0
ファイル: HomeController.cs プロジェクト: coolcode/app
        public ActionResult ArchiveList(int page = 1)
        {
            var archive = new ArchiveController();

            return archive.Top();
        }