private NuGetPackageReference GetSpecFlowPackage(IProjectScope projectScope, IEnumerable <NuGetPackageReference> packageReferences, out SpecFlowProjectTraits specFlowProjectTraits)
        {
            specFlowProjectTraits = SpecFlowProjectTraits.None;
            if (packageReferences == null)
            {
                return(null);
            }
            var packageReferencesArray = packageReferences.ToArray();
            var detector        = new SpecFlowPackageDetector(projectScope.IdeScope.FileSystem);
            var specFlowPackage = detector.GetSpecFlowPackage(packageReferencesArray);

            if (specFlowPackage != null)
            {
                var specFlowVersion = specFlowPackage.Version.Version;
                if (detector.IsMsBuildGenerationEnabled(packageReferencesArray) ||
                    IsImplicitMsBuildGeneration(detector, specFlowVersion, packageReferencesArray))
                {
                    specFlowProjectTraits |= SpecFlowProjectTraits.MsBuildGeneration;
                }
                if (detector.IsXUnitAdapterEnabled(packageReferencesArray))
                {
                    specFlowProjectTraits |= SpecFlowProjectTraits.XUnitAdapter;
                }
                if (detector.IsCucumberExpressionPluginEnabled(packageReferencesArray))
                {
                    specFlowProjectTraits |= SpecFlowProjectTraits.CucumberExpression;
                }
            }

            return(specFlowPackage);
        }
 private bool IsImplicitMsBuildGeneration(SpecFlowPackageDetector detector, Version specFlowVersion, NuGetPackageReference[] packageReferencesArray)
 {
     return(specFlowVersion >= new Version(3, 3, 57) &&
            detector.IsSpecFlowTestFrameworkPackagesUsed(packageReferencesArray));
 }