public ActionResult Edit(TestLab testLab) { TestLabPrice tl = labEntity.TestLabPrices.FirstOrDefault(x => x.TestLabId == testLab.testLabId); tl.Price = testLab.Price; labEntity.SaveChanges(); return(RedirectToAction("Index")); }
public ActionResult DeleteConfirmed(int id) { TestLab testLab = db.TestLabs.Find(id); db.TestLabs.Remove(testLab); db.SaveChanges(); return(RedirectToAction("Index")); }
/// ------------------------------------------------------------------- /// <summary>Call this to initialize the class so that one can call the /// entry points depending on which framework is used</summary> /// ------------------------------------------------------------------- public StressScenarioTests(UIA.AutomationElement element, bool testEvents, bool testChildren, int numThreads, TestLab testLab, IApplicationCommands commands) : base(element, null, TestPriorities.PriAll, TypeOfControl.UnknownControl, TypeOfPattern.Unknown, null, testEvents, commands) { _testChildren = testChildren; _numThreads = numThreads; _testLab = testLab; //PopulateAutomationElementProperties(ref _automationProperties, ref _automationPatterns); }
/// ------------------------------------------------------------------- /// <summary>Return whether the attribute is set to Stable</summary> /// ------------------------------------------------------------------- internal static bool Stable(string methodName, TestLab testLab) { Type type = typeof(StressTests); MethodInfo method = type.GetMethod(methodName); StressBuckets testAttribute = (StressBuckets)method.GetCustomAttributes(true)[0]; return(testAttribute.TestWorks == TestWorks.Stable && testAttribute.BugNumber == 0); //&& (testAttribute.TestLab & testLab) == testLab; }
public ActionResult Edit([Bind(Include = "IdTestLab,TestLabName")] TestLab testLab) { if (ModelState.IsValid) { db.Entry(testLab).State = EntityState.Modified; db.SaveChanges(); return(RedirectToAction("Index")); } return(View(testLab)); }
public ActionResult Create([Bind(Include = "IdTestLab,TestLabName")] TestLab testLab) { if (ModelState.IsValid) { db.TestLabs.Add(testLab); db.SaveChanges(); return(RedirectToAction("Index")); } return(View(testLab)); }
ITestLab GetOrCreateTestLab(string testLabName) { var testLab = TestLabCollection.TestLabs.FirstOrDefault(tl => string.Equals(tl.Name, testLabName, StringComparison.CurrentCultureIgnoreCase)); if (null != testLab) { return(testLab); } testLab = new TestLab { Name = testLabName }; TestLabCollection.TestLabs.Add(testLab); return(testLab); }
// GET: TestLabs/Delete/5 public ActionResult Delete(int?id) { if (id == null) { return(new HttpStatusCodeResult(HttpStatusCode.BadRequest)); } TestLab testLab = db.TestLabs.Find(id); if (testLab == null) { return(HttpNotFound()); } return(View(testLab)); }
public void Should_create_second_testRun_of_default_workflow_object_to_another_workflow_and_another_testLab_Running_as_json() { GIVEN_first_testWorkflow(TestConstants.Workflow03); WorkflowCollection.Workflows[0].IsDefault = true; Defaults.Workflow = WorkflowCollection.Workflows[0].Name; GIVEN_second_testWorkflow(); var secondTestWorkflow = WorkflowCollection.Workflows.Skip(1).First(); var secondTestLab = new TestLab(); TestLabCollection.TestLabs.Add(secondTestLab); secondTestWorkflow.SetTestLab(secondTestLab); WHEN_sending_testRun_as_json("def", TestRunStatuses.Running); WHEN_sending_testRun_as_json("NAC", TestRunStatuses.Running); THEN_there_should_be_the_following_number_of_testRun_objects(2); THEN_testRun_is_running(TestRunQueue.TestRuns[0]); THEN_testRun_is_running(TestRunQueue.TestRuns[1]); }
[NUnit.Framework.Test] // [MbUnit.Framework.Test][NUnit.Framework.Test][Fact] public void ShouldCreateSecondTestRunObjectToAnotherWorkflowAndAnotherTestLabRunningAsJson() { GivenFirstTestWorkflow(); GivenSecondTestWorkflow(); var secondTestWorkflow = WorkflowCollection.Workflows.Skip(1).First(); var secondTestLab = new TestLab(); TestLabCollection.TestLabs.Add(secondTestLab); secondTestWorkflow.SetTestLab(secondTestLab); WhenSendingTestRunAsJson(TestConstants.Workflow01Name, TestRunStatuses.Running); WhenSendingTestRunAsJson(TestConstants.Workflow02Name, TestRunStatuses.Running); ThenThereShouldBeTheFollowingNumberOfTestRunObjects(2); ThenTestRunIsRunning(TestRunQueue.TestRuns[0]); ThenTestRunIsRunning(TestRunQueue.TestRuns[1]); ThenTestRunIdIs(1, Guid.Parse(_response.Headers[Resources.NewTestRun_lastTestRunId])); }
public void ShouldCreateSecondTestRunOfDefaultWorkflowObjectToAnotherWorkflowAndAnotherTestLabRunningAsJson() { GivenFirstTestWorkflow(TestConstants.Workflow03); WorkflowCollection.Workflows[0].IsDefault = true; Defaults.Workflow = WorkflowCollection.Workflows[0].Name; GivenSecondTestWorkflow(); var secondTestWorkflow = WorkflowCollection.Workflows.Skip(1).First(); var secondTestLab = new TestLab(); TestLabCollection.TestLabs.Add(secondTestLab); secondTestWorkflow.SetTestLab(secondTestLab); WhenSendingTestRunAsJson(TestConstants.Workflow03Name, TestRunStatuses.Running); WhenSendingTestRunAsJson(TestConstants.Workflow02Name, TestRunStatuses.Running); ThenThereShouldBeTheFollowingNumberOfTestRunObjects(2); ThenTestRunIsRunning(TestRunQueue.TestRuns[0]); ThenTestRunIsRunning(TestRunQueue.TestRuns[1]); ThenTestRunIdIs(1, Guid.Parse(_response.Headers[Tmx_Core_Resources.NewTestRun_lastTestRunId])); }
/// ------------------------------------------------------------------- /// <summary>Constructor of object to pass to the thread</summary> /// ------------------------------------------------------------------- public PacketInfo( UIA.AutomationElement applicationElement, UIA.AutomationElement element, IApplicationCommands appCommands, TestLab testLab, int actionCount, ArrayList automationProperties, ArrayList automationPatterns, Scenario scenario) { _applicationElement = applicationElement; _element = element; _appCommands = appCommands; _testLab = testLab; _actionCount = actionCount; _automationProperties = automationProperties; _automationPatterns = automationPatterns; _scenario = scenario; _testLab = testLab; }
/// ------------------------------------------------------------------- /// <summary> /// Build up the _methods variable with all the methods associated with the patterns, /// AutomationElement, etc. buckets so we can call them. /// /// TODO: Make this a static methods so we don't build this up for each thread /// </summary> /// ------------------------------------------------------------------- private void BuildMethodsTable(TestLab testLab, TestWorks testWorks, Scenario scenario) { Type type = Type.GetType("Microsoft.Test.UIAutomation.Tests.Scenarios.StressTests"); System.Diagnostics.Debug.Assert(type != null); if (type != null) { foreach (MethodInfo method in type.GetMethods(BindingFlags.Public | BindingFlags.Static | BindingFlags.DeclaredOnly)) { foreach (Attribute attr in method.GetCustomAttributes(false)) { if (attr is StressBuckets) { StressBuckets sb = (StressBuckets)attr; if (((sb.TestWorks & testWorks) == testWorks) && (((sb.TestLab & testLab) == testLab) || testLab == TestLab.PushPullData) && ((sb.Scenario & scenario) == scenario) ) { // Only create the if (!_testMethods.ContainsKey(sb.PatternName)) { ArrayList list = new ArrayList(); _testMethods.Add(sb.PatternName, list); Console.WriteLine(sb.PatternName); } _appCommands.TraceMethod("Adding: " + method.Name); ((ArrayList)_testMethods[sb.PatternName]).Add(method); } } } } } }
/// ------------------------------------------------------------------- /// <summary>Return whether the attribute is set to Stable</summary> /// ------------------------------------------------------------------- internal static bool Stable(string methodName, TestLab testLab) { Type type = typeof(StressTests); MethodInfo method = type.GetMethod(methodName); StressBuckets testAttribute = (StressBuckets)method.GetCustomAttributes(true)[0]; return testAttribute.TestWorks == TestWorks.Stable && testAttribute.BugNumber == 0; //&& (testAttribute.TestLab & testLab) == testLab; }
ITestLab GetOrCreateTestLab(string testLabName) { var testLab = TestLabCollection.TestLabs.FirstOrDefault(tl => tl.Name.ToLower() == testLabName.ToLower()); if (null != testLab) return testLab; testLab = new TestLab { Name = testLabName }; TestLabCollection.TestLabs.Add(testLab); return testLab; }
/// ------------------------------------------------------------------- /// <summary>Constructor for custom attribute associated with the /// UIAutomation test</summary> /// ------------------------------------------------------------------- public StressBuckets(string patternName, string methodOrPropertyName, TestLab testLab, TestWorks testWorks, Scenario scenario) { _patternName = patternName; _methodOrPropertyName = methodOrPropertyName; _testLab = testLab; _testWorks = testWorks; _scenario = scenario; }
/// ------------------------------------------------------------------- /// <summary>Constructor for custom attribute associated with the /// UIAutomation test</summary> /// ------------------------------------------------------------------- public StressBuckets(string patternName, string methodOrPropertyName, TestLab testLab, TestWorks testWorks, int bugNumber) { _bugNumber = bugNumber; _patternName = patternName; _methodOrPropertyName = methodOrPropertyName; _testLab = testLab; _testWorks = TestWorks.NoWorking; // Override and set this }
ITestLab GetOrCreateTestLab(string testLabName) { var testLab = TestLabCollection.TestLabs.FirstOrDefault(tl => string.Equals(tl.Name, testLabName, StringComparison.CurrentCultureIgnoreCase)); if (null != testLab) return testLab; testLab = new TestLab { Name = testLabName }; TestLabCollection.TestLabs.Add(testLab); return testLab; }