コード例 #1
0
 public override void BeforeTest(TestDetails testDetails)
 {
     if (ThrowBeforeException)
     {
         throw new InvalidOperationException("Failure in BeforeTest.");
     }
 }
コード例 #2
0
        public virtual List <TestDetails> GetAllTestWithType()
        {
            SqlConnection connection = new SqlConnection(Connection);

            string query = "SELECT * FROM  testDetail";

            connection.Open();

            SqlCommand         command  = new SqlCommand(query, connection);
            SqlDataReader      reader   = command.ExecuteReader();
            List <TestDetails> TestList = new List <TestDetails>();

            if (reader.HasRows)
            {
                while (reader.Read())
                {
                    string      name = reader["test"].ToString();
                    decimal     Fee  = (decimal)reader["fee"];
                    string      type = reader["type"].ToString();
                    TestDetails test = new TestDetails(name, Fee, type);

                    TestList.Add(test);
                }
                reader.Close();
            }
            connection.Close();
            return(TestList);
        }
コード例 #3
0
        public void StartTest(ReporterTestInfo testInfo)
        {
            currentTest = new Test(index, testInfo.TestName, executionUid + "-" + index);
            DateTime dateTime = DateTime.Now;

            currentTest.timestamp   = dateTime.ToString("HH:mm:ss");
            currentTest.date        = dateTime.ToString("yyyy/MM/dd");
            currentTest.className   = testInfo.FullyQualifiedTestClassName;
            currentTest.description = testInfo.FullyQualifiedTestClassName;
            string   scenarioName = testInfo.FullyQualifiedTestClassName.Split('.')[testInfo.FullyQualifiedTestClassName.Split('.').Length - 2];
            Scenario scenario;

            if (machine.IsChildWithNameExists(scenarioName))
            {
                scenario = (Scenario)machine.GetChildWithName(scenarioName);
            }
            else
            {
                scenario = new Scenario(scenarioName);
                if (machine.children != null)
                {
                    // We need to copy all the properties from the first scenario.
                    // Failing to do so will cause that the tests in the ElsaticSearch, for example, will not have properties.
                    scenario.scenarioProperties = ((Scenario)machine.children[0]).scenarioProperties;
                }
                machine.AddChild(scenario);
            }
            scenario.AddChild(currentTest);
            ExecutionWasAddedOrUpdated(execution);
            testDetails = new TestDetails(currentTest.uid);
        }
コード例 #4
0
        public async Task <IActionResult> Edit(int id, [Bind("TestId,Status")] TestDetails testDetails)
        {
            if (id != testDetails.TestId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    _context.Update(testDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestDetailsExists(testDetails.TestId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction(nameof(Index)));
            }
            return(View(testDetails));
        }
コード例 #5
0
        public ActionResult GetTests(string TestGroupID)
        {
            try
            {
                int testGroupID = Convert.ToInt32(TestGroupID);
                IEnumerable <REF_TEST_X_TEST_GROUP_TB> testGroupByTest = _testRepo.GetTestsByTestGroupID(testGroupID);
                List <TestDetails> testDetails = new List <TestDetails>();

                foreach (var row in testGroupByTest)
                {
                    TestDetails item = new TestDetails()
                    {
                        TestDescription = row.REF_TEST_TB.SZ_DESCRIPTION,
                        TestGroupID     = row.N_TEST_GROUP_SYSID,
                        TestID          = row.N_TEST_SYSID
                    };
                    testDetails.Add(item);
                }

                return(Json(testDetails, JsonRequestBehavior.AllowGet));
            }
            catch (Exception ex)
            {
                if (ex.InnerException == null)
                {
                    ViewBag.Message = "Function: TestGroupController.GetTests_GET\n\nError: " + ex.Message;
                }
                else
                {
                    ViewBag.Message = "Function: TestGroupController.GetTests_GET\n\nError: " + (ex.Message + "\n\nInnerException: " + ex.InnerException.Message);
                };
                Session["ErrorMessage"] = ViewBag.Message;
                return(RedirectToAction("InternalServerError", "Error"));
            };
        }
        public void AfterTest(TestDetails testDetails)
        {
            _watch.Stop();

            Console.WriteLine(testDetails.Fixture);
            Console.WriteLine("Execution Time:  {0}", _watch.Elapsed);
        }
コード例 #7
0
        /// <summary>
        /// Unset keyboard controller
        /// </summary>
        public override void AfterTest(TestDetails testDetails)
        {
            // Shut down (and implicitly dispose) the keyboard controller we created.
            KeyboardController.Shutdown();

            base.AfterTest(testDetails);
        }
コード例 #8
0
 protected StepBuilder(Expression <Action> action, string callerMember)
 {
     ExistingSteps = new List <Step> {
         new Step(action, StepType.Given)
     };
     TestDetails = new TestDetails(callerMember, Guid.NewGuid());
 }
コード例 #9
0
        public void AfterTest(TestDetails details)
        {
            Console.WriteLine("----- Beginning Duality environment teardown -----");

            // Remove NUnit Console logs
            Log.Game.RemoveOutput(this.consoleLogOutput);
            Log.Core.RemoveOutput(this.consoleLogOutput);
            Log.Editor.RemoveOutput(this.consoleLogOutput);
            this.consoleLogOutput = null;

            if (this.dummyWindow != null)
            {
                ContentProvider.ClearContent();
                ContentProvider.DisposeDefaultContent();
                this.dummyWindow.Dispose();
                this.dummyWindow = null;
            }
            DualityApp.Terminate();
            Environment.CurrentDirectory = this.oldEnvDir;

            // Save local testing memory
            if (TestContext.CurrentContext.Result.Status == TestStatus.Passed && !System.Diagnostics.Debugger.IsAttached)
            {
                Formatter.WriteObject(TestHelper.LocalTestMemory, TestHelper.LocalTestMemoryFilePath, FormattingMethod.Xml);
            }

            Console.WriteLine("----- Duality environment teardown complete -----");
        }
コード例 #10
0
        public override void BeforeTest(TestDetails details)
        {
            if (!details.IsSuite)
            {
                return;
            }

            if (TestActorSystem.Instance != null)
            {
                return;
            }

            var system = ActorSystem.Configure()
                         .Playground()
                         .UseInMemoryPubSubStore()
                         .StreamProvider <AzureQueueStreamProvider>("aqp", new Dictionary <string, string>
            {
                { "DataConnectionString", "UseDevelopmentStorage=true" },
                { "DeploymentId", "test" },
            })
                         .TweakCluster(cfg =>
            {
                cfg.DefaultKeepAliveTimeout(TimeSpan.FromMinutes(1));
                cfg.Globals.RegisterStorageProvider <MemoryStorage>("MemoryStore");
            })
                         .Assemblies(GetType().Assembly)
                         .Interceptor <TestInterceptor>();

            TestActorSystem.Instance = system.Done();
            TestActorSystem.Instance.Start();
        }
コード例 #11
0
 internal StepBuilder(Runnable runnable, string callerMember, string callerFile)
 {
     ExistingSteps = new List <Step> {
         new Step(runnable, StepType.Given)
     };
     TestDetails = new TestDetails(callerMember, callerFile, Guid.NewGuid());
 }
コード例 #12
0
 public void BeforeTest(TestDetails testDetails)
 {
     if (ScriptingEnvironment.IsRunningOnMono() && (ScriptingEnvironment.GetMonoVersion() < new Version(major, minor, build)))
     {
         Assert.Ignore($"Requires Mono {major}.{minor}.{build} or above");
     }
 }
コード例 #13
0
 public void BeforeTest(TestDetails testDetails)
 {
     if (ScriptingEnvironment.IsRunningOnMono() && (ScriptingEnvironment.GetMonoVersion() < new Version(4, 0, 0)))
     {
         Assert.Ignore("Requires Mono 4");
     }
 }
コード例 #14
0
 public override void AfterTest(TestDetails testDetails)
 {
     if (ThrowAfterException)
     {
         throw new InvalidOperationException("Failure in AfterTest.");
     }
 }
コード例 #15
0
        public void BeforeTest(TestDetails details)
        {
            Console.WriteLine("----- Beginning Duality Editor environment setup -----");

            // Set environment directory to Duality binary directory
            this.oldEnvDir = Environment.CurrentDirectory;
            string codeBaseURI  = typeof(DualityEditorApp).Assembly.CodeBase;
            string codeBasePath = codeBaseURI.StartsWith("file:") ? codeBaseURI.Remove(0, "file:".Length) : codeBaseURI;

            codeBasePath = codeBasePath.TrimStart('/');
            Console.WriteLine("Testing Editor Assembly: {0}", codeBasePath);
            Environment.CurrentDirectory = Path.GetDirectoryName(codeBasePath);

            // Add some Console logs manually for NUnit
            if (this.consoleLogOutput == null)
            {
                this.consoleLogOutput = new TextWriterLogOutput(Console.Out);
            }
            Log.AddGlobalOutput(this.consoleLogOutput);

            // Create a dummy window for the editor
            if (this.dummyWindow == null)
            {
                this.dummyWindow = new MainForm();
            }

            // Initialize the Duality Editor
            DualityEditorApp.Init(this.dummyWindow, false);

            Console.WriteLine("----- Duality Editor environment setup complete -----");
        }
コード例 #16
0
 public bool LastTestViewSuccess(TestDetails detail)
 {
     //detail.posted_time = DateTime.ParseExact(detail.posted_time, "yyyy-MM-dd HH:mm:ss", null).ToString("dd/MM/yyyy HH:mm");
     tests.Insert(0, detail);
     tests.OrderByDescending(x => x.posted_time);
     return(true);
 }
コード例 #17
0
 /// <summary/>
 public override void BeforeTest(TestDetails testDetails)
 {
     if (!MiscUtils.IsUserAdmin)
     {
         Assert.Ignore("Requires administrator privileges");
     }
 }
コード例 #18
0
        public async Task <IActionResult> Edit(int id, [Bind("AthleteId,AthleteName,TestId,Distance,MyProperty")] TestDetails testDetails)
        {
            if (id != testDetails.AthleteId)
            {
                return(NotFound());
            }

            if (ModelState.IsValid)
            {
                try
                {
                    testDetails.MyProperty = this.checkFitness(testDetails.Distance);
                    _context.Update(testDetails);
                    await _context.SaveChangesAsync();
                }
                catch (DbUpdateConcurrencyException)
                {
                    if (!TestDetailsExists(testDetails.AthleteId))
                    {
                        return(NotFound());
                    }
                    else
                    {
                        throw;
                    }
                }
                return(RedirectToAction("Index", "TestDetails", new { id = testDetails.TestId }));
            }
            return(View(testDetails));
        }
コード例 #19
0
        public IActionResult Dashboard()
        {
            List <StudentScore> stu = _context.StudentScores.Where(s => s.StudentID == "student1").ToList();


            StudentDashboardViewModel testDetails = new StudentDashboardViewModel();

            testDetails.StudentId = "student1";

            foreach (StudentScore ts in stu)
            {
                var details = _context.Tests.Where(s => s.TestID == ts.TestID).FirstOrDefault();

                TestDetails temp = new TestDetails
                {
                    TestName   = details.TestName,
                    TestId     = ts.TestID,
                    Course     = details.CourseID,
                    CourseId   = details.CourseID,
                    Marks      = ts.MarksScored.ToString(),
                    MaxMarks   = details.MaxMarks.ToString(),
                    PassOrFail = ts.MarksScored >= Convert.ToInt32(details.CutOffMarks) ? "Y" : "N"
                };


                testDetails.TestDetail.Add(temp);
            }

            return(View(testDetails));
        }
コード例 #20
0
 public void BeforeTest(TestDetails testDetails)
 {
     if (!ScriptingEnvironment.IsNet45OrNewer())
     {
         Assert.Ignore("Requires .NET 4.5");
     }
 }
コード例 #21
0
        public void AfterTest(TestDetails details)
        {
            Console.WriteLine("----- Beginning Duality environment teardown -----");

            // Remove NUnit Console logs
            Log.RemoveGlobalOutput(this.consoleLogOutput);
            this.consoleLogOutput = null;

            if (this.dummyWindow != null)
            {
                ContentProvider.ClearContent();
                ContentProvider.DisposeDefaultContent();
                this.dummyWindow.Dispose();
                this.dummyWindow = null;
            }

            // Save local testing memory. As this uses Duality serializers,
            // it needs to be done before terminating Duality.
            if (TestContext.CurrentContext.Result.Status == TestStatus.Passed && !System.Diagnostics.Debugger.IsAttached)
            {
                Serializer.WriteObject(TestHelper.LocalTestMemory, TestHelper.LocalTestMemoryFilePath, typeof(XmlSerializer));
            }

            DualityApp.Terminate();
            Environment.CurrentDirectory = this.oldEnvDir;

            Console.WriteLine("----- Duality environment teardown complete -----");
        }
コード例 #22
0
        /// <summary/>
        public override void BeforeTest(TestDetails testDetails)
        {
            base.BeforeTest(testDetails);

            m_activationContext = new ActivationContextHelper("FieldWorks.Tests.manifest");
            m_currentActivation = m_activationContext.Activate();
            m_debugProcs        = new DebugProcs();

            if (!Platform.IsWindows)
            {
                try
                {
                    using (var process = System.Diagnostics.Process.GetCurrentProcess())
                    {
                        // try to change PTRACE option so that unmanaged call stacks show more useful
                        // information. Since Ubuntu 10.10 a normal user is no longer allowed to use
                        // PTRACE. This prevents call stacks and assertions from working properly.
                        // However, we can set a flag on the currently running process to allow
                        // it. See also the similar code in Generic/ModuleEntry.cpp
                        prctl(PR_SET_PTRACER, (IntPtr)process.Id, IntPtr.Zero, IntPtr.Zero,
                              IntPtr.Zero);
                    }
                }
                catch (Exception e)
                {
                    // just ignore any errors we get
                }
            }
        }
コード例 #23
0
        // GET: Tests/Details/5
        public async Task <IActionResult> Details(int?id)
        {
            if (id == null)
            {
                return(NotFound());
            }

            var test = await _context.Test
                       .FirstOrDefaultAsync(m => m.Id == id);

            if (test == null)
            {
                return(NotFound());
            }
            if (test.Type == "Coopertest")
            {
                TempData["time"] = "hidden";
            }
            else
            {
                TempData["dist"] = "hidden";
            }


            var details = await _context.UserTestMapping.Where(m => m.TId == test.Id).Include(x => x.User).ToListAsync();

            TempData["TId"] = test.Id;
            var model = new TestDetails(test, details);

            return(View(model));
        }
コード例 #24
0
        public void AddTestDetails(int executionId, TestDetails testDetails)
        {
            WebRequest request = WebRequest.Create(baseUri + "executions/" + executionId + "/details");

            request.Method = "POST";
            SendContent(request, testDetails);
        }
コード例 #25
0
        //Insert New member in test
        public ActionResult InsertAthlete(MemberTestMapping mb_details)
        {
            var checkIfAlreadyAddedOrNot = (from mt in DB.MemberTestMapping
                                            where mt.MemberId == mb_details.MemberId &&
                                            mt.TestDetailsId == mb_details.TestDetailsId select mt).ToList();
            TestDetails getTestDetails = (from td in DB.TestDetails
                                          where td.TestDetailsId == mb_details.TestDetailsId
                                          select td).SingleOrDefault();
            int?noOfCount = getTestDetails.NoOfParticipants;

            if (checkIfAlreadyAddedOrNot.Count > 0)
            {
                return(Json(new { msgdetail = "faill", resultCode = 2 }));
            }
            DB.MemberTestMapping.Add(mb_details);
            int result = DB.SaveChanges();

            if (result > 0)
            {
                noOfCount = noOfCount + 1;
            }
            getTestDetails.NoOfParticipants = noOfCount;
            DB.SaveChanges();
            return(Json(new { msgdetail = "success", resultCode = result }));
        }
コード例 #26
0
 /// <summary>
 ///     Executed after each test is run
 /// </summary>
 /// <param name="testDetails">Provides details about the test that has just been run.</param>
 public override void AfterTest(TestDetails testDetails)
 {
     if (WhenToClear == Clear.AfterTest)
     {
         ClearCaches( );
     }
 }
コード例 #27
0
        internal async Task <Scenario> Invoke(TestDetails testDetails)
        {
            var scenario = new Scenario(ExistingSteps, testDetails);
            await scenario.Execute();

            return(scenario);
        }
コード例 #28
0
 /// <summary>
 ///     Executed before each test is run
 /// </summary>
 /// <param name="testDetails">Provides details about the test that is going to be run.</param>
 public override void BeforeTest(TestDetails testDetails)
 {
     if (WhenToClear == Clear.BeforeTest)
     {
         ClearCaches( );
     }
 }
コード例 #29
0
 /// <summary>
 /// Set the message box adapter
 /// </summary>
 public override void BeforeTest(TestDetails testDetails)
 {
     base.BeforeTest(testDetails);
     m_PreviousAdapter = s_CurrentAdapter;
     s_CurrentAdapter  = (IMessageBox)Activator.CreateInstance(m_AdapterType);
     MessageBoxUtils.Manager.SetMessageBoxAdapter(s_CurrentAdapter);
 }
コード例 #30
0
 public void BeforeTest(TestDetails testDetails)
 {
     if (!IsNet45OrNewer())
     {
         Assert.Ignore("Requires .NET 4.5");
     }
 }