Esempio n. 1
0
        public void ExtensionsPacketsDuration()
        {
            Console.WriteLine("Clean machine.");
            BehaviorsRegression.CleanMachine();
            using (var systemSettings = new SystemSettings())
            {
                systemSettings.packetDuration = 120;
                systemSettings.packetSize     = 2000000;
                systemSettings.depotSize      = 50;
            }

            Console.WriteLine("Install AT and wait 2.5 min.");
            AT.Install();
            Thread.Sleep(150000);
            Service.Stop(NunitSettings.ServiceWdName);
            Thread.Sleep(timeToWait);
            Service.Stop(NunitSettings.ServiceDttName);

            Console.WriteLine("Check quantity of generated packets.");
            var packets = PacketParser.GetPackets(NunitSettings.DttPath, NunitSettings.TempFolder);

            Assert.IsTrue(packets.Count == 2, "Quantity of packets incorrect:" + packets.Count);

            Console.WriteLine("Clean machine.");
            BehaviorsRegression.CleanMachine();
        }
        /// <summary>
        /// 读取AT实例的特性
        /// </summary>
        /// <typeparam name="AT">特性类型</typeparam>
        /// <returns>特性实例</returns>
        public virtual AT GetCustomerAttribute <AT>()
            where AT : Attribute
        {
            AT result = null;

            if (list == null)
            {
                list = new List <Attribute>();
                object[] attributeArray = memberInfo.GetCustomAttributes(false);
                if (attributeArray.Length != 0)
                {
                    foreach (object item in attributeArray)
                    {
                        Attribute attribute = item as Attribute;
                        if (attribute != null)
                        {
                            list.Add(attribute);
                        }
                    }
                }
            }

            Type resultType = typeof(AT);

            foreach (Attribute item in list)
            {
                if (resultType == item.GetType())
                {
                    result = item as AT;
                }
            }

            return(result);
        }
        public InstallerRegression()
        {
            _locationInstalFile = NunitSettings.InstallFileLocation;
            _dttPath            = NunitSettings.DttPath;
            _major = Environment.OSVersion.Version.Major;
            using (var systemSettings = new SystemSettings())
            {
                //Set pro
                systemSettings.projectPath = NunitSettings.ProjectPath;
                //Set value packet-duration = 20
                systemSettings.packetDuration = 1800;
                //data-transfer-settings poll-period = ‘20’
                systemSettings.dttPollPeriod = 20;
            }
            _win7LocationData         = DttRegression.PathToPacket;
            _winXpAnd2003LocationData = DttRegression.PathToPacket;

            _environmentVariable = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");
            Debug.Assert(_environmentVariable != null, "_environmentVariable != null");
            if (_environmentVariable != null | _major != 5 | _environmentVariable.Contains("64"))
            {
                _msiValid = AT.DirectoryExists(@"C:\Program Files (x86)\MsiVal2") ? @"C:\Program Files (x86)\MsiVal2" : @"C:\Program Files\MsiVal2";
            }
            else
            {
                _msiValid = @"C:\Program Files\MsiVal2";
            }
        }
Esempio n. 4
0
        private void clickElement(string targetPropertyType, string targetPropertyValue, string targetControlType, string containerPropertyType, string containerPropertyValue, string containerControlType)
        {
            AT _Parent  = base.GetInvokerElement(containerPropertyType, containerPropertyValue, containerControlType);
            AT _Element = base.GetInvokerElement(targetPropertyType, targetPropertyValue, targetControlType, _Parent);

            _Element.DoClick();
        }
Esempio n. 5
0
        public IEnumerable <VAccountByMandatary> GetAccountByMandatary(int IdUserMandatary)
        {
            Command command = new Command("P_GetAccountMandatary", true);

            command.AddParameter("@IdMandatary", IdUserMandatary);
            return(Connection.ExecuteReader(command, (AT) => AT.ToDalAccountByMandatary()));
        }
Esempio n. 6
0
        private void btnSupprAt_Click(object sender, EventArgs e)
        {
            try{
                int     i = cbxSelectAt1.SelectedIndex;
                Atelier AT;
                AT = Atelier.listeAteliers().ElementAt(i);
                AT.supprimerAtelier();

                cbxSelectAt1.ResetText();
                txbNomAt2.Clear();
                txbCapaciteAt2.Clear();

                lblDeleted1.Text = "Atelier supprimé !";

                //On réactualise la combobox pour enlever l'élément supprimé de la liste
                cbxSelectAt1.Items.Clear();
                cbxSelectAt1.ResetText();
                foreach (Atelier unAtelier in Atelier.listeAteliers())
                {
                    cbxSelectAt1.Items.Add(unAtelier.IdAtelier + " (" + unAtelier.NomAtelier + ")");
                }

                //On réactualise le DataGridView pour le remplir automatiquement
                remplirListeAteliers();
            }
            catch (Exception ex) {
                MessageBox.Show("ERREUR! Plus d'informations ci-dessous :");
                MessageBox.Show("Message d'erreur : " + ex.Message);
            }
        }
Esempio n. 7
0
        public async Task <ActionResult <AT> > PostAT(AT aT)
        {
            _context.Ats.Add(aT);
            await _context.SaveChangesAsync();

            return(CreatedAtAction("GetAT", new { id = aT.Id }, aT));
        }
Esempio n. 8
0
        // --------------------
        // POSITION
        // --------------------

        public float GetPosition()
        {
            // The D-pad will be recorded as two axes or four buttons, depending on the gamepad driver used.
            // Measure both the axes and the buttons, and ignore the one that returns an error.
            // In the future, always call the one that worked.
            if (AxisType == AT.Axis)
            {
                return(GetAxisValue());
            }
            if (AxisType == AT.Buttons)
            {
                return(GetButtonValue());
            }

            float value = GetAxisValue();

            if (value.IsNotEqualTo(0))
            {
                AxisType = AT.Axis;
            }
            else
            {
                value = GetButtonValue();
                if (value.IsNotEqualTo(0))
                {
                    AxisType = AT.Buttons;
                }
            }

            return(value);
        }
Esempio n. 9
0
        public void DttFilesWithVariousExtensionsToTransfer()
        {
            Console.WriteLine("Change SystemSetting.xml and Install AT.");
            BehaviorsRegression.CleanMachine();
            using (var systemSettings = new SystemSettings())
            {
                systemSettings.setTransferItemParameter("packets", "source", @"C:\Application Data\Enkata\Activity Tracker\packets\*.png");
            }

            Console.WriteLine("Install AT.");
            AT.Install();
            CreateUserDirectory();

            Console.WriteLine("Create file with mp4 and png extension.");
            File.WriteAllText(Path.Combine(PathToPacketsAT, NamePacketNewExtension), "save");
            File.WriteAllText(Path.Combine(DttRegression.PathToVideoAT, NameVideoNewExtension), "save");
            Service.Stop(NunitSettings.ServiceDttName);

            Console.WriteLine("Check that transfered files.");
            Assert.IsTrue(File.Exists(Path.Combine(DttRegression.PathToPacketsDTT,
                                                   NamePacketNewExtension)), "Couldn't find transfer file:" + NamePacketNewExtension);
            if (ScreenRecording == "ON")
            {
                Assert.IsTrue(File.Exists(Path.Combine(DttRegression.PathToRecordingDTT,
                                                       NameVideoNewExtension)), "Couldn't find transfer file:" + NameVideoNewExtension);
            }

            Console.WriteLine("Clean machine");
            BehaviorsRegression.CleanMachine();
        }
Esempio n. 10
0
 private static void InstallAt()
 {
     AT.Install();
     Assert.IsTrue(AT.WatchdogExists());
     Assert.IsTrue(AT.DttExists());
     Assert.IsTrue(AT.OsrExists());
 }
        public void LaunchAndCheckCrash(long testTimes)
        {
            var crashTimes = 0;

            UtilCmd.Clear();
            for (var i = 1; i < testTimes; i++)
            {
                var titleTotal = $"Reopen Times: {i} - Crash Times: {crashTimes}";
                var logLines   = UtilFile.ReadFileByLine(LogPathLaunch);
                logLines.ForEach(UtilCmd.WriteLine);
                //logLines.ForEach(line => UtilCmd.WriteLine(line));
                var launchLogTime  = GetRestartLogTime();
                var screenshotPath = Path.Combine(ScreenshotsPath, crashTimes.ToString());
                UtilProcess.StartProcess(SwLnkPath);
                Timeout = 1;
                UtilCmd.WriteTitle($"{titleTotal} - Searching MP+ UI.");
                var startTime     = DateTime.Now;
                var dialogWarning = UtilWait.ForAnyResultCatch(() =>
                {
                    UtilCmd.WriteTitle($"{titleTotal} - Searching Warning dialog of the MP+ in 60s. Time elapsed: {(DateTime.Now - startTime).Seconds}s.");
                    SwMainWindow = new AT().GetElement(MPObj.MainWindow, Timeout);  // The MP+ will change after a while.
                    return(SwMainWindow.GetElement(MPObj.DialogWarning, Timeout));
                }, 60, 2);
                if (SwMainWindow == null)
                {
                    UtilCapturer.Capture(i.ToString());
                    UtilFile.WriteFile(LogPathLaunch, $"{launchLogTime}: Reopen Times: {i} - Could not open MasterPlus.");
                    crashTimes++;
                }
                UtilTime.WaitTime(1);
                UtilProcess.KillProcessByName(SwProcessName);
                UtilTime.WaitTime(1);
            }
        }
        private void _ScrollMenuItemSubItem(AT reassignDropdown)
        {
            try
            {
                var left = (int)reassignDropdown.GetElementInfo().RectangleLeft() + 10;
                var top  = (int)reassignDropdown.GetElementInfo().RectangleTop() + 50;
                switch (_scrollNum)
                {
                case 0:
                    HWSimulator.HWSend.MoveCursorAndDo(left, top, HWSimulator.HWSend.MouseKeys.WHEELDOWN);
                    UtilTime.WaitTime(1);
                    HWSimulator.HWSend.MoveCursorAndDo(left, top, HWSimulator.HWSend.MouseKeys.WHEELDOWN);
                    UtilTime.WaitTime(1);
                    HWSimulator.HWSend.MoveCursorAndDo(left, top, HWSimulator.HWSend.MouseKeys.WHEELDOWN);
                    UtilTime.WaitTime(1);
                    _scrollNum = 1;
                    break;

                case 1:
                    HWSimulator.HWSend.MoveCursorAndDo(left, top, HWSimulator.HWSend.MouseKeys.WHEELUP);
                    UtilTime.WaitTime(1);
                    HWSimulator.HWSend.MoveCursorAndDo(left, top, HWSimulator.HWSend.MouseKeys.WHEELUP);
                    UtilTime.WaitTime(1);
                    HWSimulator.HWSend.MoveCursorAndDo(left, top, HWSimulator.HWSend.MouseKeys.WHEELUP);
                    UtilTime.WaitTime(1);
                    _scrollNum = 0;
                    break;
                }
            }
            catch (Exception e)
            {
                throw new Exception("Failed to _ScrollMenuItemSubItem. " + e.Message);
            }
        }
 private void _CollapseReassignMenus(AT reassignDropdown)
 {
     try
     {
         while (true)
         {
             var all = reassignDropdown.GetElementsAllChild(returnNullWhenException: true).GetATCollection();
             if (!all.Any((x) => x.GetElementInfo().Name().Equals(MPObj.ReassignCatalogListItem.Name)))
             {
                 break;
             }
             for (var i = 0; i < all.Length; i++)
             {
                 if (!all[i].GetElementInfo().Name().Equals(MPObj.ReassignCatalogListItem.Name))
                 {
                     continue;
                 }
                 all[i - 1].DoClickPoint(0.5);
                 break;
             }
         }
     }
     catch (Exception e)
     {
         throw new Exception("Failed to _CollapseReassignMenus. " + e.Message);
     }
 }
Esempio n. 14
0
        private void Form_Main_Load(object sender, EventArgs e)
        {
            AT aa = new AT();

            aa = aa.GetElement(Name: "Program Manager");
            Console.ReadKey();
        }
Esempio n. 15
0
 private void OpenFile(string fileID)
 {
     if (string.IsNullOrWhiteSpace(fileID))
     {
         return;
     }
     //开启任务
     AT.Create <string[]>(() =>
     {
         string fileid = fileID;
         bool check    = AuthPermission.Auth(LoginUser.UserId, Convert.ToInt32(fileid), FilePermission.Read);
         if (check)
         {
             return(LoadData(fileid));
         }
         else
         {
             MessageBox.Show("您没有权限阅读该文件", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         return(null);
         //上一步任务成功之后,执行下一个操作
     }).Run((i) =>
     {
         if (i != null)
         {
             ShowFileDialog(i[2], i[0], i[1], i[3]);
         }
         //完成所有操作执行操作
     }, () => { frmLoading.Close(); });
 }
Esempio n. 16
0
        public void DttNegativePollPeriod()
        {
            Console.WriteLine("Install AT.");
            BehaviorsRegression.CleanMachine();
            using (var systemSettings = new SystemSettings())
            {
                systemSettings.dttPollPeriod = -1;
            }
            CreateUserDirectory();
            CreateSamplePackets();
            AT.Install();
            Service.Stop(NunitSettings.ServiceDttName);

            Console.WriteLine("Check Dtt log.");
            Thread.Sleep(ServiceDelay);
            var countError = CountWordInFile(Path.Combine(_pathToLog, GetNameOfLogFile()), "ERROR");
            var contentLog = File.ReadAllText(Path.Combine(_pathToLog, GetNameOfLogFile()));

            Assert.IsTrue(countError == 0, "Error:" + countError);
            //TODO: replace to Assert.IsTrue when bug DEV-6471//
            Assert.IsFalse(contentLog.Contains("Can't move file "));
            Assert.IsFalse(File.Exists(Path.Combine(DttRegression.PathToPacketsDTT,
                                                    NamePacket)), "Couldn't find transfered file:" + NamePacket);
            if (ScreenRecording == "ON")
            {
                Assert.IsFalse(File.Exists(Path.Combine(DttRegression.PathToRecordingDTT,
                                                        NameVideo)), "Couldn't find transfered file:" + NameVideo);
            }

            Console.WriteLine("Clean machine");
            BehaviorsRegression.CleanMachine();
        }
Esempio n. 17
0
        public void ExtensionsPacketsStoreNetwork()
        {
            Console.WriteLine("Clean machine.");
            BehaviorsRegression.CleanMachine();
            using (var systemSettings = new SystemSettings())
            {
                systemSettings.rawDataStoragePackets = NunitSettings.ShareFolder;
                systemSettings.packetDuration        = 5;
            }

            Console.WriteLine("Install AT");
            AT.Install();
            Thread.Sleep(30000);

            Console.WriteLine("Check number of packets in custom folder.");
            var packets = AT.GetContentOfFolder(NunitSettings.ShareFolder, "*.packet");

            Assert.IsTrue(packets.Count >= 9, "Incorrect quantity of packets:" + packets.Count);

            Console.WriteLine("Clean machine.");
            BehaviorsRegression.CleanMachine();
            foreach (var packet in packets)
            {
                File.Delete(Path.Combine(NunitSettings.ShareFolder, packet.Name));
            }
        }
Esempio n. 18
0
        public void DttNoWriteAccessToDestinationDir()
        {
            BehaviorsRegression.CleanMachine();
            Console.WriteLine("Creat Folders and files.");
            CreateUserDirectory();
            CreateSamplePackets();
            Directory.CreateDirectory(DttRegression.PathToPacketsDTT);
            Directory.CreateDirectory(DttRegression.PathToRecordingDTT);

            Console.WriteLine("Change permision of folder and Install AT");
            SetAccessToObject(AccessControlType.Deny, FileSystemRights.Write, DttRegression.PathToPacketsDTT);
            SetAccessToObject(AccessControlType.Deny, FileSystemRights.Write, DttRegression.PathToRecordingDTT);

            AT.Install();
            Service.Stop(NunitSettings.ServiceDttName);

            Console.WriteLine("Check dtt log");
            var countError = CountWordInFile(Path.Combine(_pathToLog, GetNameOfLogFile()), "ERROR");
            var contentLog = File.ReadAllText(Path.Combine(_pathToLog, GetNameOfLogFile()));

            Assert.IsTrue(countError >= 2, "Error:" + countError);
            var file = "Can't move file " + _pathToPacketInLog + "/packets/" + NamePacket + " Error: Access is denied.";

            Assert.IsTrue(contentLog.ToLower().Contains(file.ToLower()));
            if (ScreenRecording == "ON")
            {
                Assert.IsTrue(contentLog.Contains("Can't move file " + _pathToPacketInLog + "/video/" + NameVideo + " Error: Access is denied."));
            }

            Console.WriteLine("Clean machine");
            BehaviorsRegression.CleanMachine();
        }
Esempio n. 19
0
        public async Task <IActionResult> PutAT(Guid id, AT aT)
        {
            if (id != aT.Id)
            {
                return(BadRequest());
            }

            _context.Entry(aT).State = EntityState.Modified;

            try
            {
                await _context.SaveChangesAsync();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!ATExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    return(StatusCode(StatusCodes.Status500InternalServerError));
                }
            }

            return(NoContent());
        }
Esempio n. 20
0
        public void DttNoWriteAccessToSourceDir()
        {
            BehaviorsRegression.CleanMachine();
            Console.WriteLine("Change permision of folder and Install AT");
            CreateUserDirectory();
            CreateSamplePackets();
            FileSystemRights rights = FileSystemRights.Delete | FileSystemRights.Write |
                                      FileSystemRights.WriteExtendedAttributes | FileSystemRights.WriteData | FileSystemRights.CreateFiles | FileSystemRights.Modify |
                                      FileSystemRights.WriteAttributes;

            SetAccessToObject(AccessControlType.Deny, rights, PathToPacketsAT);
            SetAccessToObject(AccessControlType.Deny, rights, DttRegression.PathToVideoAT);
            AT.Install();
            Service.Stop(NunitSettings.ServiceDttName);

            Console.WriteLine("Check dtt log");
            var countError = CountWordInFile(Path.Combine(_pathToLog, GetNameOfLogFile()), "ERROR");
            var contentLog = File.ReadAllText(Path.Combine(_pathToLog, GetNameOfLogFile()));

            //TODO new bug
            Assert.IsTrue(countError == 0);
            Assert.IsTrue(!contentLog.Contains("Can't move file"));
            Assert.IsTrue(File.Exists(Path.Combine(DttRegression.PathToPacketsDTT,
                                                   NamePacket)), "Couldn't find transfered file:" + NamePacket);
            if (ScreenRecording == "ON")
            {
                Assert.IsTrue(File.Exists(Path.Combine(DttRegression.PathToRecordingDTT,
                                                       NameVideo)), "Couldn't find transfered file:" + NameVideo);
            }

            Console.WriteLine("Clean machine");
            BehaviorsRegression.CleanMachine();
        }
Esempio n. 21
0
 public void TaxCalc()
 {
     AnnualPay *= 12;
     ANP        = AnnualPay;
     Tax        = AT.ToString("C");
     NetPay     = ANP.ToString("C");
 }
Esempio n. 22
0
        public void DttUnreachableDestinationDir()
        {
            Console.WriteLine("Set to SystemSettings.xml not existing disk for Dtt dest.");
            BehaviorsRegression.CleanMachine();
            using (var systemSettings = new SystemSettings())
            {
                systemSettings.setTransferItemParameter("packets", "dest", @"L:\DataOutput\%FILE.CREATION.DATE%\LOGS\%HASHED_ID_SHA2%.%SESSION_ID%.%FILE.CREATION.DATE%.%FILE.CREATION.TIME%.%FILE%");
                systemSettings.setTransferItemParameter("OS log information", "dest", @"L:\%FILE.CREATION.DATE%\LOGS\%HASHED_ID_SHA2%.%SESSION_ID%.%FILE.MODIFICATION.DATE%.%FILE.MODIFICATION.TIME%.os_runtime.log");
                systemSettings.setTransferItemParameter("log information", "dest", @"L:\DataOutput\%FILE.CREATION.DATE%\LOGS\%HASHED_ID_SHA2%.%SESSION_ID%.%FILE.MODIFICATION.DATE%.%FILE.MODIFICATION.TIME%.%FILE%");
            }
            CreateUserDirectory();
            CreateSamplePackets();

            Console.WriteLine("Install AT");
            AT.Install();

            Console.WriteLine("Check dtt logs");
            Service.Stop(NunitSettings.ServiceDttName);
            var countError = CountWordInFile(Path.Combine(_pathToLog, GetNameOfLogFile()), "ERROR");
            var contentLog = File.ReadAllText(Path.Combine(_pathToLog, GetNameOfLogFile()));

            Assert.IsTrue(countError >= 2);
            var error = "Can't move file " + _pathToPacketInLog + "/packets/" + NamePacket +
                        " Error: boost::filesystem::create_directory: The system cannot find the path specified";

            Assert.IsTrue(contentLog.ToLower().Contains(error.ToLower()));
            if (ScreenRecording == "ON")
            {
                Assert.IsTrue(contentLog.Contains("Can't move file " + _pathToPacketInLog + "/video/" + NameVideo + " Error: boost::filesystem::create_directory: The system cannot find the path specified"));
            }

            Console.WriteLine("Clean machine");
            BehaviorsRegression.CleanMachine();
        }
Esempio n. 23
0
        public IEnumerable <VAccountByTitular> GetAccountByTitular(int IdUserTitular)
        {
            Command command = new Command("P_GetAccountTitular", true);

            command.AddParameter("@IdTitular", IdUserTitular);
            return(Connection.ExecuteReader(command, (AT) => AT.ToDalAccountByTitular()));
        }
Esempio n. 24
0
        public void DttUnreachableSourceDir()
        {
            Console.WriteLine("Set to SystemSettings.xml not existing disk for Dtt source.");
            BehaviorsRegression.CleanMachine();
            using (var systemSettings = new SystemSettings())
            {
                systemSettings.setTransferItemParameter("packets", "dest", @"L:\DataOutput\%FILE.CREATION.DATE%\LOGS\%HASHED_ID_SHA2%.%SESSION_ID%.%FILE.CREATION.DATE%.%FILE.CREATION.TIME%.%FILE%");
                systemSettings.setTransferItemParameter("OS log information", "dest", @"L:\%FILE.CREATION.DATE%\LOGS\%HASHED_ID_SHA2%.%SESSION_ID%.%FILE.MODIFICATION.DATE%.%FILE.MODIFICATION.TIME%.os_runtime.log");
                systemSettings.setTransferItemParameter("log information", "dest", @"L:\DataOutput\%FILE.CREATION.DATE%\LOGS\%HASHED_ID_SHA2%.%SESSION_ID%.%FILE.MODIFICATION.DATE%.%FILE.MODIFICATION.TIME%.%FILE%");


                systemSettings.setTransferItemParameter("packets", "source", @"L:\Application Data\Enkata\Activity Tracker\packets\*.packet");
                systemSettings.setTransferItemParameter("OS log information", "source", @"L:\%USERPROFILE%\Application Data\OpenSpan Studio for VS 2008\*.txt");
                systemSettings.setTransferItemParameter("log information", "source", @"L:\Application Data\Enkata\Activity Tracker\log\*.log");
            }
            CreateUserDirectory();
            CreateSamplePackets();

            Console.WriteLine("Install AT");
            AT.Install();

            Console.WriteLine("Check dtt logs");
            Service.Stop(NunitSettings.ServiceDttName);
            var countError = CountWordInFile(Path.Combine(_pathToLog, GetNameOfLogFile()), "ERROR");

            Assert.IsTrue(countError == 0);
            Assert.IsFalse(Directory.Exists(NunitSettings.DttPath));

            Console.WriteLine("Clean machine");
            BehaviorsRegression.CleanMachine();
        }
Esempio n. 25
0
        public TestIt()
        {
            _MpCases         = new MasterPlusTestCases();
            KeysSpy          = new KeysSpyOp(_MpCases.MpActions.KeySpyRelativePath);
            _portalTestFlows = new PortalTestFlows();
            //AssembleTopMenu();
            GetKeyboardKeysFromKeyMapTabFile();
            GetMatrixFromFile();
            UtilKeys.SetPhysicalKeyStatus(KbKeys.SC_KEY_NUM_LOCK.KeyValue, UtilKeys.Status.On);
            UtilKeys.SetPhysicalKeyStatus(KbKeys.SC_KEY_CAP.KeyValue, UtilKeys.Status.Off);

            //UtilLoop.testA();
            //_MpCases.Case_AssignInLoop(blAssignKey: true, blVerifyKeyWork: false, blScanCodeInput: true);

            _MpCases.Case_AssignInLoop(true, false, true);
            this.Suit_KeyMappingBaseTest("SK652");
            UtilProcess.KillAllProcessesByName("wmplayer");
            UtilTime.WaitTime(1);
            var p         = UtilWmp.StartWmpWithMedias(Path.Combine(_MpCases.MpActions.MediaFolderPath, "1.mp3"), Path.Combine(_MpCases.MpActions.MediaFolderPath, "2.mp3"), Path.Combine(_MpCases.MpActions.MediaFolderPath, "3.mp3"));
            var wmpWindow = new AT().GetElementFromHwndAndWaitAppears(p);
            var sliderbar = wmpWindow.GetElementFromDescendants(new ATElementStruct()
            {
                ControlType = AT.ControlType.Slider
            });
            var barValue1 = sliderbar.DoGetValue();

            UtilTime.WaitTime(0.5);
            var barValue2 = sliderbar.DoGetValue();

            _MpCases.Case_CheckAllKeysOnRelayController();
        }
Esempio n. 26
0
        public void DttUseOfDttVariables()
        {
            Console.WriteLine("Create DTT environment variable.");
            BehaviorsRegression.CleanMachine();
            Environment.SetEnvironmentVariable("DTT", NunitSettings.InstallFileLocation, EnvironmentVariableTarget.Machine);

            Console.WriteLine("Set new Environment variable to dtt in 'dest'");
            using (var systemSettings = new SystemSettings())
            {
                systemSettings.setTransferItemParameter("packets", "dest", @"%DTT%\DataOutput\%FILE.CREATION.DATE%\LOGS\%HASHED_ID_SHA2%.%SESSION_ID%.%FILE.CREATION.DATE%.%FILE.CREATION.TIME%.%FILE%");
                systemSettings.setTransferItemParameter("OS log information", "dest", @"%DTT%\%FILE.CREATION.DATE%\LOGS\%HASHED_ID_SHA2%.%SESSION_ID%.%FILE.MODIFICATION.DATE%.%FILE.MODIFICATION.TIME%.os_runtime.log");
                systemSettings.setTransferItemParameter("log information", "dest", @"%DTT%\DataOutput\%FILE.CREATION.DATE%\LOGS\%HASHED_ID_SHA2%.%SESSION_ID%.%FILE.MODIFICATION.DATE%.%FILE.MODIFICATION.TIME%.%FILE%");
            }

            Console.WriteLine("Install AT");
            AT.Install();

            Console.WriteLine("Create packets and video");
            CreateUserDirectory();
            CreateSamplePackets();
            Service.Stop(NunitSettings.ServiceDttName);

            Console.WriteLine("Check files have been transferred correctly.");
            Assert.IsTrue(File.Exists(Path.Combine(Path.Combine(Path.Combine(NunitSettings.InstallFileLocation + "\\DATAOUTPUT", AT.GetDate()), "PACKETS"),
                                                   NamePacket)), "Couldn't find transfered file:" + NamePacket);
            if (ScreenRecording == "ON")
            {
                Assert.IsTrue(File.Exists(Path.Combine(Path.Combine(Path.Combine(NunitSettings.InstallFileLocation + "\\DATAOUTPUT", AT.GetDate()), "RECORDINGS"),
                                                       NameVideo)), "Couldn't find transfered file:" + NameVideo);
            }

            Console.WriteLine("Clean machine");
            BehaviorsRegression.CleanMachine();
        }
Esempio n. 27
0
        public void InstallerWrongBitness()
        {
            Console.WriteLine("Installer (wrong bitness)");
            BehaviorsRegression.CleanMachine();
            var environmentVariable = Environment.GetEnvironmentVariable("PROCESSOR_ARCHITECTURE");

            if (environmentVariable != null && environmentVariable.Contains("64"))
            {
                var myJob  = new ThreadTest();
                var thread = new Thread(myJob.InstallMsi64)
                {
                    Name = "first"
                };
                thread.Start();
                Thread.Sleep(WaitError + 60000);
                Assert.IsTrue(AT.WindowExists(NameWindowWaring, NameAlert64Bit));
                Calculator.ClickOnButtonByName(NameWindowWaring, "OK");
            }
            else
            {
                var myJob1  = new ThreadTest();
                var thread1 = new Thread(myJob1.InstallMsi32)
                {
                    Name = "Second"
                };
                thread1.Start();
                Thread.Sleep(WaitError);
                Assert.IsTrue(AT.WindowExists(NameWindowWaringXp, NameAlert32Bit), "Incorrect warning message");
                Calculator.ClickOnButtonByName(NameWindowWaringXp, "OK");
            }
        }
Esempio n. 28
0
        public void DttCorruptedSystemSettings()
        {
            Console.WriteLine("Install AT");
            BehaviorsRegression.CleanMachine();
            AT.Install();

            Console.WriteLine("Stop DTT and remove systemsettings");
            Service.Stop(NunitSettings.ServiceDttName);

            SystemSettings.StoreSystemSettings();
            SystemSettings.DeleteSystemSettings();

            Service.Start(NunitSettings.ServiceDttName);
            Thread.Sleep(Delay);
            Service.Stop(NunitSettings.ServiceDttName);

            Console.WriteLine("Check log DTT");
            var contentOfFolder = AT.GetContentOfFolder(_pathToLog, "*.log");
            var countError      = 0;
            var contentLog      = "";

            foreach (var fileInfo in contentOfFolder)
            {
                if (fileInfo.Name.Contains("Data Transfer Tool"))
                {
                    countError = CountWordInFile(Path.Combine(_pathToLog, fileInfo.Name), "ERROR");
                    contentLog = File.ReadAllText(Path.Combine(_pathToLog, fileInfo.Name));
                }
            }
            Assert.IsTrue(countError == 1);
            Assert.IsTrue(contentLog.Contains("Configuration file is absent or access is denied. Considering session as not intended for AT."));

            Console.WriteLine("Restore systemsettings");
            BehaviorsRegression.CleanMachine();
        }
Esempio n. 29
0
        public void ExtensionsPacketsDurationInvalid()
        {
            Console.WriteLine("Clean machine.");
            BehaviorsRegression.CleanMachine();
            using (var systemSettings = new SystemSettings())
            {
                systemSettings.packetDuration = -10;
            }

            Console.WriteLine("Install AT and check services.");
            AT.Install();
            Thread.Sleep(timeToWait);
            Assert.IsFalse(AT.OsrExists(), "OSR process started with incorrect packet duration.");
            StopAllServices();

            Console.WriteLine("Check osrun time log file.");
            var errorNegativeDuration = "System.ArgumentException: Invalid maximum packet duration parameter.";
            var errorPacketBuilder    = "Error initializing Packet Builder";

            Assert.IsTrue(GetContentOfLog(nameOSRunTimeLog).Contains(errorNegativeDuration.Replace(" ", "")), "Incorrect error in osruntime log file. Negative value in  packet duration.");
            Assert.IsTrue(GetContentOfLog(nameOSRunTimeLog).Contains(errorPacketBuilder.Replace(" ", "")), "Incorrect error in osruntime log file. Packet builder.");

            Console.WriteLine("Clean machine.");
            BehaviorsRegression.CleanMachine();
        }
Esempio n. 30
0
 private void 查看ToolStripMenuItem_Click(object sender, EventArgs e)
 {
     frmLoading.ShowTop();
     //Add By 顾挺 2017-05-12  意图:学员单线程打开文件,体验实在太差,为了增强用户体验,因为大文件加载速度实在太慢,添加多线程
     //开启任务
     AT.Create <string[]>(() =>
     {
         string fileid = skinDataGridView1.CurrentRow.Cells["FileId"].Value.ToString();
         bool check    = AuthPermission.Auth(LoginUser.UserId, Convert.ToInt32(fileid), FilePermission.Read);
         if (check)
         {
             return(LoadData(fileid));
         }
         else
         {
             MessageBox.Show("您没有权限阅读该文件", "系统提示", MessageBoxButtons.OK, MessageBoxIcon.Warning);
         }
         return(null);
         //上一步任务成功之后,执行下一个操作
     }).Run((i) =>
     {
         if (i != null)
         {
             ShowFileDialog(i[2], i[0], i[1], i[3]);
         }
         //完成所有操作执行操作
     }, () => { frmLoading.Close(); });
 }
Esempio n. 31
0
        public override void Parse()
        {
            FrameId = (byte) parser.ReadByte();
            atCommand = parser.ReadATCommand();

            if (parser.HasMoreData()) {
                Console.WriteLine("TODO: has data!");
            }
        }
Esempio n. 32
0
 public ATCommand(AT atCommand)
 {
     this.atCommand = atCommand;
     CommandId = XBeeAPICommandId.AT_COMMAND_REQUEST;
 }
 public RemoteATCommand(AT command, XBeeNode destination)
 {
     CommandId = XBeeAPICommandId.REMOTE_AT_COMMAND_REQUEST;
     Command = command;
     Destination = destination;
 }
Esempio n. 34
0
 public ATQueueCommand(AT atCommand)
     : base(atCommand)
 {
     CommandId = XBeeAPICommandId.AT_COMMAND_QUEUE_REQUEST;
 }