コード例 #1
0
ファイル: AnnotationTest.cs プロジェクト: ZHJEE/OpenTAP
        public void TestPlanReferenceAnnotationTest()
        {
            var planname = Guid.NewGuid().ToString() + ".TestPlan";

            {
                var innerplan = new TestPlan();
                var step      = new DelayStep();
                innerplan.Steps.Add(step);
                innerplan.ExternalParameters.Add(step,
                                                 TypeData.GetTypeData(step).GetMember(nameof(DelayStep.DelaySecs)));
                innerplan.Save(planname);
            }
            try
            {
                var outerplan = new TestPlan();
                var tpr       = new TestPlanReference();
                outerplan.Steps.Add(tpr);
                tpr.Filepath.Text = planname;
                tpr.LoadTestPlan();

                var annotation = AnnotationCollection.Annotate(tpr);
                var members    = annotation.Get <IMembersAnnotation>().Members;
                var delaymem   = annotation.GetMember("Time Delay");
                Assert.IsNotNull(delaymem);
            }
            finally
            {
                File.Delete(planname);
            }
        }
コード例 #2
0
ファイル: AnnotationTest.cs プロジェクト: ZHJEE/OpenTAP
        public void ListOfStringAnnotationTpr()
        {
            var tp             = new TestPlan();
            var stepa          = new ClassWithListOfString();
            var selectedMember = TypeData.GetTypeData(stepa).GetMember(nameof(ClassWithListOfString.Selected));
            var stepb          = new ClassWithListOfString();

            tp.ChildTestSteps.Add(stepa);
            tp.ChildTestSteps.Add(stepb);
            selectedMember.Parameterize(tp, stepa, selectedMember.Name);
            selectedMember.Parameterize(tp, stepb, selectedMember.Name);

            var name = Guid.NewGuid().ToString() + ".TapPlan";

            tp.Save(name);
            var plan2 = new TestPlan();
            var tpr   = new TestPlanReference();

            plan2.ChildTestSteps.Add(tpr);
            tpr.Filepath.Text = name;
            tpr.LoadTestPlan();
            File.Delete(name);

            var member = AnnotationCollection.Annotate(tpr).GetMember(selectedMember.Name);
            var avail  = member.Get <IAvailableValuesAnnotation>();

            Assert.AreEqual(2, avail.AvailableValues.Cast <object>().Count());
        }