コード例 #1
0
 private string getFromSpecFlowFeature()
 {
     try
     {
         var         feature = _application.ActiveDocument.FullName;
         var         items   = _application.ActiveDocument.ProjectItem.ProjectItems;
         ProjectItem item    = null;
         foreach (object itm in items)
         {
             item = (ProjectItem)itm;
             break;
         }
         var codeBehind = item.Document.FullName;
         var sel        = (TextSelection)_application.ActiveDocument.Selection;
         var point      = (TextPoint)sel.ActivePoint;
         var match      = new SpecFlowFeatureParser(File.ReadAllText(feature), File.ReadAllText(codeBehind)).GetTest(point.Line - 1);
         if (match == null)
         {
             return(null);
         }
         return(match.Name);
     }
     catch
     {
     }
     return(null);
 }
コード例 #2
0
 private OnDemandRun getFromSpecFlowFeature()
 {
     try
     {
         _project = _application.ActiveDocument.ProjectItem.ContainingProject.FullName;
         var         feature = _application.ActiveDocument.FullName;
         var         items   = _application.ActiveDocument.ProjectItem.ProjectItems;
         ProjectItem item    = null;
         foreach (object itm in items)
         {
             item = (ProjectItem)itm;
             break;
         }
         var codeBehind = item.Document.FullName;
         var sel        = (TextSelection)_application.ActiveDocument.Selection;
         var point      = (TextPoint)sel.ActivePoint;
         var signature  = new SpecFlowFeatureParser(File.ReadAllText(feature), File.ReadAllText(codeBehind)).GetTest(point.Line - 1);
         if (signature == null)
         {
             return(new OnDemandRun(_project));
         }
         if (signature.Type == SignatureType.Class)
         {
             return(new OnDemandRun(_project, new string[] { }, new string[] { signature.Name }, new string[] { }));
         }
         return(new OnDemandRun(_project, new string[] { signature.Name }, new string[] { }, new string[] { }));
     }
     catch
     {
     }
     return(new OnDemandRun(_project));
 }
コード例 #3
0
        public void When_given_a_spec_flow_feature_file_and_its_an_empty_line_execute_all_specs_in_file()
        {
            var line      = 20;
            var parser    = new SpecFlowFeatureParser(getFeature("SpecflowFeature.txt"), getCodeBehind("SpecflowCodeBehind.txt"));
            var signature = parser.GetTest(line);

            Assert.That(signature.Name, Is.EqualTo("Specifications.Features.SMSPaymentsFeature"));
            Assert.That(signature.Type, Is.EqualTo(SignatureType.Class));
        }
コード例 #4
0
        public void When_given_a_spec_flow_feature_file_using_mstest_it_will_find_closest_scenario()
        {
            var line      = 41;
            var parser    = new SpecFlowFeatureParser(getFeature("SpecflowMSTestFeatures.txt"), getCodeBehind("SpecflowMSTestCodeBehind.txt"));
            var signature = parser.GetTest(line);

            Assert.That(signature.Name, Is.EqualTo("Nrk.OnDemand.Common.AcceptanceTests.Features.ReceiveVODPatternsFromPRFFeature.CreateANewVODPatternForARadioProgram"));
            Assert.That(signature.Type, Is.EqualTo(SignatureType.Method));
        }
コード例 #5
0
        public void When_given_a_spec_flow_feature_file_it_will_find_closest_scenario()
        {
            var line      = 28;
            var parser    = new SpecFlowFeatureParser(getFeature("SpecflowFeature.txt"), getCodeBehind("SpecflowCodeBehind.txt"));
            var signature = parser.GetTest(line);

            Assert.That(signature.Name, Is.EqualTo("Specifications.Features.SMSPaymentsFeature.SendMoneyFromUnregisteredUser"));
            Assert.That(signature.Type, Is.EqualTo(SignatureType.Method));
        }