Пример #1
0
 public void EndPlayback()
 {
     IsPlaybacking = false;
     OnPlaybackEnd.Invoke();
     OnPlaybackEnd       = null;
     CurrentPlaybackTest = null;
 }
Пример #2
0
 private void OnClick(object sender, EventArgs e)
 {
     // If your test is fail, you should set Assert.True(false , "msg");
     Assert.True(true);
     // ManualTest.Confirm() API will terminate WaitForConfirm() method, and will execute rest of the code.
     ManualTest.Confirm();
 }
Пример #3
0
 public async Task Clicked_CB()
 {
     CreateButton("Click me!! Test: Handle event click button");
     _button.Clicked += OnClick;
     // Waits for user confirmation.
     await ManualTest.WaitForConfirm();
 }
Пример #4
0
 public async Task Pressed_CB()
 {
     CreateButtonPage("Click me!! Test: Handle event press button");
     _button.Clicked += OnPressed;
     // Waits for user confirmation.
     await ManualTest.WaitForConfirm();
 }
Пример #5
0
        public async Task DatePicker_UIBH()
        {
            if (Device.Idiom == TargetIdiom.TV)
            {
                _testPage.UnlockUIButton();
                Assert.Pass("Not Supported");
            }
            /* TEST CODE */
            var contentPage = new ContentPage
            {
                Content = new StackLayout
                {
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    Children          =
                    {
                        new DatePicker
                        {
                            Format          = "D",
                            VerticalOptions = LayoutOptions.CenterAndExpand
                        }
                    }
                }
            };

            _testPage.ExecuteTC(contentPage);
            await ManualTest.WaitForConfirm();
        }
Пример #6
0
 public void OnPressed(object sender, EventArgs e)
 {
     // pop layout
     _testPage.getNavigationPage().PopAsync();
     // or Assert.True(false);
     Assert.True(true);
     // ManualTest.Confirm() API will terminate WaitForConfirm() method, and will execute rest of the code.
     ManualTest.Confirm();
 }
Пример #7
0
 private void PreviousTestcase()
 {
     _pressButton = NavigationButton.Previous;
     if (!ManualTest.IsConfirmed())
     {
         _tsettings.TCResult = StrResult.NOTRUN;
         ManualTest.Confirm();
     }
     else
     {
         Previous();
     }
 }
Пример #8
0
 private void NextTestcase()
 {
     _pressButton = NavigationButton.Next;
     if (!ManualTest.IsConfirmed())
     {
         _tsettings.TCResult = StrResult.NOTRUN;
         ManualTest.Confirm();
     }
     else
     {
         Next();
     }
 }
Пример #9
0
        public TestingGame()
        {
            manualTest = new ManualTest();
            manualTest.Show();
            electricityState = true;

            worker = new BackgroundWorker();

            worker.DoWork += Worker_DoWork;
            worker.WorkerSupportsCancellation = true;
            worker.WorkerReportsProgress      = false;
            worker.RunWorkerAsync();
        }
Пример #10
0
    public void StartPlayback(ManualTest manualTest, Action onEnd)
    {
        if (manualTest.RecordedInputs == null || manualTest.RecordedInputs.Count == 0)
        {
            onEnd?.Invoke();
            return;
        }

        PlaybackStartingFrame = Time.frameCount;
        OnPlaybackEnd         = onEnd;
        IsPlaybacking         = true;
        CurrentPlaybackTest   = manualTest;
    }
Пример #11
0
 protected override void OnCreate()
 {
     Console.WriteLine("TCT : OnCreate()");
     base.OnCreate();
     if (ManualTest.IsWearable())
     {
         _app = new WearableTemplate.MainPage();
     }
     else
     {
         _app = new ManualTemplate.MainPage();
     }
     LoadApplication(_app);
 }
Пример #12
0
        private static ManualTest CreateManualTest()
        {
            String     name = "Test" + Guid.NewGuid();
            ManualTest test = new ManualTest();

            test.Name  = name;
            test.Phase = PHASE_NEW;


            ManualTest created = entityService.Create <ManualTest>(workspaceContext, test);

            Assert.AreEqual <String>(name, created.Name);
            Assert.IsTrue(created.Id > 0);
            return(created);
        }
Пример #13
0
        public async Task Verbose_PRINT_TO_DLOG()
        {
            /*
             * TEST CODE - MANUAL TEST
             * use command: "sdb dlog TCT" to see log.
             */
            _message = "Verbose log message";
            Log.Verbose(TAG, _message);

            /*
             * RESULT : PASS
             * log not show "Verbose log message"
             */
            // Waits for user confirmation.
            await ManualTest.WaitForConfirm();
        }
Пример #14
0
        public async Task Error_PRINT_TO_DLOG()
        {
            /*
             * TEST CODE - MANUAL TEST
             * use command: "sdb dlog | grep TCT" to see log.
             */
            _message = "Error log message";
            Log.Error(TAG, _message);

            /*
             * RESULT : PASS
             * log show "Error log message" with Tag "TCT" and type log "E"
             */
            // Waits for user confirmation.
            await ManualTest.WaitForConfirm();
        }
Пример #15
0
 public void EndRecording()
 {
     try
     {
         if (TestingInputModule.IsPlaybacking)
         {
             return;
         }
         ManualTest       = TestingInputModule.EndRecording();
         ConsoleText.text = "Ended recording";
         Debug.Log(ConsoleText.text);
     }
     catch (Exception e)
     {
         ConsoleText.text = e.ToString();
         Debug.LogError(ConsoleText.text);
     }
 }
Пример #16
0
 /// <summary>
 /// Add manual test
 /// </summary>
 /// <param name="model"></param>
 /// <returns></returns>
 public int Add(ManualTest model)
 {
     if (this.context.ManualTests.Where(x => x.Title == model.Title).FirstOrDefault() != null)
     {
         int index = 1;
         while (true)
         {
             if (this.context.ManualTests.Where(x => x.Title == (model.Title + index.ToString())).FirstOrDefault() == null)
             {
                 break;
             }
             index++;
         }
         model.Title = model.Title + index.ToString();
     }
     this.context.ManualTests.Add(model);
     this.context.SaveChanges();
     return(model.Id);
 }
Пример #17
0
        public async Task TextColor_UILK_Test()
        {
            /* TEST CODE */
            var contentPage = new ContentPage
            {
                Content = new StackLayout
                {
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    Children          =
                    {
                        new DatePicker
                        {
                            Format          = "D",
                            TextColor       = Color.Red,
                            VerticalOptions = LayoutOptions.CenterAndExpand
                        }
                    }
                }
            };

            _testPage.ExecuteTC(contentPage);
            await ManualTest.WaitForConfirm();
        }
Пример #18
0
        public async Task Date_UILK()
        {
            /* TEST CODE */
            var contentPage = new ContentPage
            {
                Content = new StackLayout
                {
                    HorizontalOptions = LayoutOptions.CenterAndExpand,
                    VerticalOptions   = LayoutOptions.CenterAndExpand,
                    Children          =
                    {
                        new DatePicker
                        {
                            Format          = "D",
                            Date            = new DateTime(2020, 03, 10),
                            VerticalOptions = LayoutOptions.CenterAndExpand
                        }
                    }
                }
            };

            _testPage.ExecuteTC(contentPage).ExecuteTC(contentPage).ExecuteTC(contentPage);
            await ManualTest.WaitForConfirm();
        }
        public ActionResult updateManualTest(ManualTest mt, HttpPostedFileBase file)
        {
            try
            {
                if (!(file.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessing" || file.ContentType == "application/msword" || file.ContentType == "application/pdf"))
                {
                    ViewBag.Message = "Select Doc or Docx or  Pdf extention file only";
                    return(View());
                }
                else
                {
                    int teacherid = Convert.ToInt32(Session["Teacher"]);

                    //var model = db.ManualTests.Find(mt.TestId);
                    string oldfilePath = Session["url"].ToString();
                    if (file != null && file.ContentLength > 0)
                    {
                        string fileName = Guid.NewGuid() + Path.GetExtension(file.FileName);



                        file.SaveAs(Path.Combine(Server.MapPath("~/FrontEnd/File_Upload/ManualTest/"), fileName));
                        mt.TestUrl = fileName;
                        string fullPath = Request.MapPath(oldfilePath);

                        if (System.IO.File.Exists(fullPath))
                        {
                            System.IO.File.Delete(fullPath);
                        }
                        mt.CreatedDate     = DateTime.Now;
                        db.Entry(mt).State = System.Data.Entity.EntityState.Modified;
                        if (db.SaveChanges() > 0)

                        {
                            ViewBag.Message = "Data Updated";
                            return(RedirectToAction("viewtestfile"));
                        }
                        else
                        {
                            ViewBag.Message = "Not Valid File Type";
                            return(RedirectToAction("viewtestfile"));
                        }
                    }



                    //}
                    else
                    {
                        mt.TestUrl = Session["url"].ToString();
                        mt.UserId  = teacherid;
                        //mt.CourseId = model.CourseId;
                        //mt.ClassId = model.ClassId;
                        //mt.SchoolId = model.SchoolId;
                        mt.CreatedDate = DateTime.Now;


                        //db.Entry(mt).EntityState = EntityState.Detached;
                        db.Entry(mt).State = EntityState.Modified;
                        if (db.SaveChanges() > 0)
                        {
                            ViewBag.Message = "Data Updated";
                            return(RedirectToAction("viewtestfile"));
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Not Updated";
                return(View());
            }

            return(View());
        }
        public ActionResult addtestfile(tbl_TestFileValidation tfile)
        {
            int teacherid = Convert.ToInt32(Session["Teacher"]);

            int tempclassid;
            int schoolid;
            int originalclassid;

            var getteacherid = db.Teachers.Find(teacherid);

            tempclassid = getteacherid.Class_Id;
            schoolid    = getteacherid.School_Id;
            var classid = db.Tbl_Class.Where(x => x.Class_Id == tempclassid).SingleOrDefault();

            originalclassid = classid.Class_Id;
            CourseDBHandle gc = new CourseDBHandle();

            tfile.SchoolId = schoolid;
            tfile.ClassId  = originalclassid;
            List <tbl_CourseAssigntoTeacherValidation> list = gc.GetTeacherAssignedCourse(teacherid, originalclassid);

            ViewBag.course = new SelectList(list, "courseId", "courseName");


            if (tfile.UserdocFIle == null)
            {
                ModelState.AddModelError("CustomError", "Please Select File");
                return(View());
            }
            if (!(tfile.UserdocFIle.ContentType == "application/msword" || tfile.UserdocFIle.ContentType == "application/vnd.openxmlformats-officedocument.wordprocessingml.document" || tfile.UserdocFIle.ContentType == "application/pdf"))
            {
                ViewBag.Message = "Select  doc or Docx Pdf extention file only ";
                return(View());
            }

            try
            {
                ManualTest mantestfile = new ManualTest();

                string fileName = Guid.NewGuid() + Path.GetExtension(tfile.UserdocFIle.FileName);
                tfile.UserdocFIle.SaveAs(Path.Combine(Server.MapPath("~/FrontEnd/File_Upload/ManualTest/"), fileName));


                mantestfile.TestUrl     = fileName;
                mantestfile.CourseId    = tfile.CourseId;
                mantestfile.ClassId     = tfile.ClassId;
                mantestfile.CreatedDate = DateTime.Now;
                mantestfile.Duration    = tfile.Duration;
                mantestfile.SchoolId    = tfile.SchoolId;
                mantestfile.UserId      = Convert.ToInt32(Session["Teacher"]);



                db.ManualTests.Add(mantestfile);
                db.SaveChanges();


                ModelState.Clear();

                ViewBag.Message = "Data Submitted";
            }
            catch (Exception ex)
            {
                ViewBag.Message = "Not Submitted";
                return(View());
            }



            return(View());
        }
Пример #21
0
        private void MakeTestPage()
        {
            _mainLayout = new StackLayout()
            {
                Orientation       = StackOrientation.Vertical,
                IsVisible         = true,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.CenterAndExpand,
                Spacing           = 5,
                Padding           = new Thickness(10),
            };
            _descriptionTitle = new Label()
            {
                Text = "DESCRIPTION:",
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                HeightRequest     = 23,
                Margin            = new Thickness(40, 0, 0, 0),
                FontSize          = 5,
                TextColor         = Color.White,
            };

            StackLayout functionLayout = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                IsVisible         = true,
                HeightRequest     = 30,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                Spacing           = 2,
                Margin            = new Thickness(0, 0, 0, 15)
            };

            _mainBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "H",
                HeightRequest = 30,
                WidthRequest  = 55,
                FontSize      = 5
            };

            _mainBtn.Clicked += (sender, e) =>
            {
                _pressButton = NavigationButton.Home;
                if (!ManualTest.IsConfirmed())
                {
                    _tsettings.TCResult = StrResult.NOTRUN;
                    ManualTest.Confirm();
                }
                else
                {
                    _navigationPage.PopAsync();
                }
            };

            _prevBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "<<",
                HeightRequest = 30,
                WidthRequest  = 55,
                FontSize      = 4
            };

            _prevBtn.Clicked += (sender, e) =>
            {
                PreviousTestcase();
            };

            _nextBtn = new Button()
            {
                Text = ">>",
                HorizontalOptions = LayoutOptions.Start,
                HeightRequest     = 30,
                WidthRequest      = 55,
                FontSize          = 4
            };

            _nextBtn.Clicked += (sender, e) =>
            {
                NextTestcase();
            };

            _tcResultText = new Label()
            {
                HorizontalOptions       = LayoutOptions.Start,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                HorizontalTextAlignment = TextAlignment.Center,
                VerticalTextAlignment   = TextAlignment.Center,
                HeightRequest           = 30,
                FontSize = 3
            };
            functionLayout.Children.Add(_mainBtn);
            functionLayout.Children.Add(_tcResultText);
            functionLayout.Children.Add(_prevBtn);
            functionLayout.Children.Add(_nextBtn);
            // Show description
            ShowDescription();

            var navigationLayout = new StackLayout()
            {
                Orientation       = StackOrientation.Horizontal,
                IsVisible         = true,
                HeightRequest     = 30,
                HorizontalOptions = LayoutOptions.CenterAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                Spacing           = 5,
            };

            _passBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "P",
                HeightRequest = 30,
                IsEnabled     = false,
                FontSize      = 5,
                WidthRequest  = 60
            };

            _passBtn.Clicked += (sender, e) =>
            {
                if (!ManualTest.IsConfirmed())
                {
                    _tsettings.TCResult = StrResult.PASS;
                    ManualTest.Confirm();
                }
            };

            _failBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "F",
                HeightRequest = 30,
                IsEnabled     = false,
                FontSize      = 5,
                WidthRequest  = 60
            };

            _failBtn.Clicked += (sender, e) =>
            {
                if (!ManualTest.IsConfirmed())
                {
                    _tsettings.TCResult = StrResult.FAIL;
                    ManualTest.Confirm();
                }
            };

            _blockBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "B",
                HeightRequest = 30,
                IsEnabled     = false,
                FontSize      = 5,
                WidthRequest  = 60
            };

            _blockBtn.Clicked += (sender, e) =>
            {
                if (!ManualTest.IsConfirmed())
                {
                    _tsettings.TCResult = StrResult.BLOCK;
                    ManualTest.Confirm();
                }
            };

            _runBtn = new Button()
            {
                HorizontalOptions = LayoutOptions.Start,
                Text          = "R",
                HeightRequest = 30,
                FontSize      = 5,
                WidthRequest  = 60
            };

            _runBtn.Clicked += (sender, e) =>
            {
                LockUIButton();
                _pressButton           = NavigationButton.NA;
                _tsettings.Testcase_ID = _tcIDList[_tcIndex];
                _tsettings.TCResult    = "";
                _tunitRunner.Execute();
            };

            navigationLayout.Children.Add(_passBtn);
            navigationLayout.Children.Add(_failBtn);
            navigationLayout.Children.Add(_blockBtn);
            navigationLayout.Children.Add(_runBtn);

            _tcUILayout = new StackLayout()
            {
                Orientation       = StackOrientation.Vertical,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.Start,
                HeightRequest     = 40,
                WidthRequest      = 280,
                Margin            = new Thickness(10, 0, 10, 0)
            };

            _mainLayout.Children.Add(_summaryLabel1);
            _mainLayout.Children.Add(_summaryLabel2);
            _mainLayout.Children.Add(_descriptionTitle);
            _mainLayout.Children.Add(_tcDescriptions);
            _mainLayout.Children.Add(_tcUILayout);
            _mainLayout.Children.Add(navigationLayout);
            _mainLayout.Children.Add(functionLayout);
            _tcContentPage = new ContentPage()
            {
                Content = _mainLayout
            };
            NavigationPage.SetHasNavigationBar(_tcContentPage, false);
        }
        /// <summary>
        /// Create rtf document
        /// </summary>
        /// <param name="test"></param>
        /// <returns></returns>
        private RtfDocument CreateManualTestRtf(ManualTest test)
        {
            var doc = new RtfDocument(PaperSize.A4, PaperOrientation.Portrait,
                                      Lcid.TraditionalChinese);
            var           times = doc.createFont("Times New Roman");
            RtfParagraph  par;
            RtfCharFormat fmt;
            RtfImage      img;

            par           = doc.addParagraph();
            par.Alignment = Align.Center;
            par.DefaultCharFormat.Font = times;
            par.setText(test.Title);
            fmt          = par.addCharFormat();
            fmt.FontSize = 18;
            for (int i = 0; i < test.CloseQuestions.Count; i++)
            {
                par           = doc.addParagraph();
                par.Alignment = Align.Left;
                par.DefaultCharFormat.Font = times;
                par.setText((i + 1) + "." + ConvertHtmlToText(test.CloseQuestions.ElementAt(i).Content) + "  (" + test.CloseQuestions.ElementAt(i).Points + " т.)");
                fmt          = par.addCharFormat();
                fmt.FontSize = 14;
                var answerIn = 'А';

                foreach (var item in test.CloseQuestions.ElementAt(i).Images)
                {
                    img = doc.addImageFromUrl(this.cloudinaryService.GetImageUrl(item.Source), item.Name
                                              , ImageFileType.Jpg);
                    img.Width  = 100;
                    img.Heigth = 100;
                }
                foreach (var item2 in test.CloseQuestions.ElementAt(i).Answers)
                {
                    par           = doc.addParagraph();
                    par.Alignment = Align.Left;
                    par.DefaultCharFormat.Font = times;
                    par.setText(answerIn + ") " + ConvertHtmlToText(item2.Content));
                    answerIn++;
                    foreach (var item3 in item2.Images)
                    {
                        img = doc.addImageFromUrl(this.cloudinaryService.GetImageUrl(item3.Source), item3.Name
                                                  , ImageFileType.Jpg);
                        img.Width  = 80;
                        img.Heigth = 60;
                        img.Margins[Direction.Bottom] = 5;
                        img.Margins[Direction.Left]   = 5;
                        img.Margins[Direction.Right]  = 5;
                        img.Margins[Direction.Top]    = 5;
                    }
                }
                par           = doc.addParagraph();
                par.Alignment = Align.Left;
                par.DefaultCharFormat.Font = times;
                par.setText(" ");
            }
            for (int i = 0; i < test.OpenQuestions.Count; i++)
            {
                par           = doc.addParagraph();
                par.Alignment = Align.Left;
                par.DefaultCharFormat.Font = times;
                par.setText((i + 1 + test.CloseQuestions.Count) + "." + ConvertHtmlToText(test.OpenQuestions.ElementAt(i).Content) + "  (" + test.OpenQuestions.ElementAt(i).Points + " т.)");
                fmt          = par.addCharFormat();
                fmt.FontSize = 14;

                foreach (var item in test.OpenQuestions.ElementAt(i).Images)
                {
                    img = doc.addImageFromUrl(this.cloudinaryService.GetImageUrl(item.Source), item.Name
                                              , ImageFileType.Jpg);
                    img.Width  = 100;
                    img.Heigth = 100;
                }
            }
            return(doc);
        }