Ejemplo n.º 1
0
 public EyetrackerEntities(String connString = null)
     : base((connString ?? EyetrackerEntities.BuildConnString()))
 {
     Candidates      = new Candidates();
     TestDefinitions = new TestDefinitions();
     Tests           = new Tests();
 }
Ejemplo n.º 2
0
        public void LoadAllCandidatesAndTests()
        {
            Tests.Clear();
            Candidates.Clear();
            TestDefinitions.Clear();

            Test_Definition.Load();
            Candidate.Load();
            Test.Load();

            foreach (Test_Definition td in Test_Definition)
            {
                TestDefinitions.Add(td);
            }


            foreach (Candidate c in Candidate)
            {
                Candidates.Add(c);
                foreach (Test t in c.Test)
                {
                    Tests.Add(t);
                    if (t.Test_Definition == null && t.test_definition_id > 0)
                    {
                        t.Test_Definition = db.Test_Definition.FirstOrDefault(td => td.Id == t.test_definition_id);
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void Add(UnitTest unitTest, UnitTestResult result)
        {
            var testEntry = new TestEntry()
            {
                ExecutionId = Guid.NewGuid().ToString(),
                TestId      = Guid.NewGuid().ToString(),
                TestListId  = TestListId,
            };

            unitTest.Id           = result.TestId = testEntry.TestId;
            unitTest.Execution.Id = result.ExecutionId = testEntry.ExecutionId;
            result.TestListId     = TestListId;

            Results.Add(result);
            TestDefinitions.Add(unitTest);
            TestEntries.Add(testEntry);
        }
Ejemplo n.º 4
0
            /// <summary>
            /// Adds the result of a test method into the log.
            /// </summary>
            /// <param name="test">The test metadata.</param>
            /// <param name="storage">The storage value.</param>
            /// <param name="codeBase">The code base value.</param>
            /// <param name="adapterTypeName">The adapter type name.</param>
            /// <param name="className">The class name.</param>
            /// <param name="testListName">The test list name.</param>
            /// <param name="computerName">The computer name.</param>
            /// <param name="startTime">The start time.</param>
            /// <param name="endTime">The end time.</param>
            /// <param name="outcome">The outcome.</param>
            public void AddTestMethodResult(
                ITestMethod test,
                string storage,
                string codeBase,
                string adapterTypeName,
                string className,
                string testListName,
                string computerName,
                DateTime startTime,
                DateTime endTime,
                TestOutcome outcome)
            {
                if (test == null)
                {
                    throw new ArgumentNullException("test");
                }

                // Friendly name of the test
                string name = test.Name;

                // Generate GUIDs.
                string testId      = Guid.NewGuid().ToString();
                string executionId = Guid.NewGuid().ToString();
                string testListId  = GetTestListGuid(testListName);

                // UnitTest element.
                SimpleXElement unitTest = CreateElement("UnitTest");

                unitTest.SetAttributeValue("name", name);
                unitTest.SetAttributeValue("storage", storage);
                unitTest.SetAttributeValue("id", testId);

                SimpleXElement owners      = CreateElement("Owners");
                SimpleXElement owner       = CreateElement("Owner");
                string         ownerString = test.Owner ?? string.Empty;

                owner.SetAttributeValue("name", ownerString);
                owners.Add(owner);
                unitTest.Add(owners);

                if (!string.IsNullOrEmpty(test.Description))
                {
                    SimpleXElement description = CreateElement("Description");
                    description.SetValue(test.Description);
                    unitTest.Add(description);
                }

                SimpleXElement execution = CreateElement("Execution");

                execution.SetAttributeValue("id", executionId);
                unitTest.Add(execution);

                // TestMethod element.
                SimpleXElement testMethod = CreateElement("TestMethod");

                testMethod.SetAttributeValue("codeBase", codeBase);
                testMethod.SetAttributeValue("adapterTypeName", adapterTypeName);
                testMethod.SetAttributeValue("className", className);
                testMethod.SetAttributeValue("name", name);
                unitTest.Add(testMethod);

                TestDefinitions.Add(unitTest);

                // TestEntry element.
                SimpleXElement testEntry = CreateElement("TestEntry");

                testEntry.SetAttributeValue("testId", testId);
                testEntry.SetAttributeValue("executionId", executionId);
                testEntry.SetAttributeValue("testListId", testListId);
                TestEntries.Add(testEntry);

                // UnitTestResult element.
                SimpleXElement unitTestResult = CreateElement("UnitTestResult");

                unitTestResult.SetAttributeValue("executionId", executionId);
                unitTestResult.SetAttributeValue("testId", testId);
                unitTestResult.SetAttributeValue("testName", name);
                unitTestResult.SetAttributeValue("computerName", computerName);

                TimeSpan duration = endTime.Subtract(startTime);

                unitTestResult.SetAttributeValue("duration", duration.ToString());

                unitTestResult.SetAttributeValue("startTime", ToDateString(startTime));
                unitTestResult.SetAttributeValue("endTime", ToDateString(endTime));
                unitTestResult.SetAttributeValue("testType", UnitTestTestTypeId);
                unitTestResult.SetAttributeValue("outcome", outcome.ToString());
                unitTestResult.SetAttributeValue("testListId", testListId.ToString());

                // Add any pending items
                foreach (SimpleXElement pending in _pendingElements)
                {
                    unitTestResult.Add(pending);
                }
                _pendingElements.Clear();

                Results.Add(unitTestResult);
            }
Ejemplo n.º 5
0
 public void AddToTestDefinitions(TestDefinitions testDefinitions)
 {
     base.AddObject("TestDefinitions", testDefinitions);
 }
Ejemplo n.º 6
0
 public static TestDefinitions CreateTestDefinitions(global::System.Guid testSetId, string testSetName, global::System.Guid variableId, string variableLabel, short variableIndex, global::System.Guid valueId, string valueLabel, short value)
 {
     TestDefinitions testDefinitions = new TestDefinitions();
     testDefinitions.TestSetId = testSetId;
     testDefinitions.TestSetName = testSetName;
     testDefinitions.VariableId = variableId;
     testDefinitions.VariableLabel = variableLabel;
     testDefinitions.VariableIndex = variableIndex;
     testDefinitions.ValueId = valueId;
     testDefinitions.ValueLabel = valueLabel;
     testDefinitions.Value = value;
     return testDefinitions;
 }