Permalink
Browse files

VS2010: SpecFlow incorrectly detected changes in the configuration (I…

…ssue 215)
  • Loading branch information...
1 parent 3e814e8 commit 616f55ad0365df14da12dac28c1e65dbee8d066b @gasparnagy gasparnagy committed Oct 2, 2012
View
23 Generator/Configuration/GeneratorConfiguration.cs
@@ -99,31 +99,32 @@ private bool IsSpecified(ConfigurationElement configurationElement)
#region Equality
- public bool Equals(GeneratorConfiguration other)
+ protected bool Equals(GeneratorConfiguration other)
{
- if (ReferenceEquals(null, other)) return false;
- if (ReferenceEquals(this, other)) return true;
- return Equals(other.FeatureLanguage, FeatureLanguage) && Equals(other.ToolLanguage, ToolLanguage) && Equals(other.GeneratorUnitTestProvider, GeneratorUnitTestProvider) && other.AllowDebugGeneratedFiles.Equals(AllowDebugGeneratedFiles) && other.AllowRowTests.Equals(AllowRowTests);
+ return Equals(FeatureLanguage, other.FeatureLanguage) && Equals(ToolLanguage, other.ToolLanguage) && string.Equals(GeneratorUnitTestProvider, other.GeneratorUnitTestProvider) && AllowDebugGeneratedFiles.Equals(other.AllowDebugGeneratedFiles) && AllowRowTests.Equals(other.AllowRowTests) && GenerateAsyncTests.Equals(other.GenerateAsyncTests) && string.Equals(GeneratorPath, other.GeneratorPath) && UsesPlugins.Equals(other.UsesPlugins);
}
public override bool Equals(object obj)
{
if (ReferenceEquals(null, obj)) return false;
if (ReferenceEquals(this, obj)) return true;
- if (obj.GetType() != typeof (GeneratorConfiguration)) return false;
+ if (obj.GetType() != this.GetType()) return false;
return Equals((GeneratorConfiguration) obj);
}
public override int GetHashCode()
{
unchecked
{
- int result = (FeatureLanguage != null ? FeatureLanguage.GetHashCode() : 0);
- result = (result*397) ^ (ToolLanguage != null ? ToolLanguage.GetHashCode() : 0);
- result = (result*397) ^ (GeneratorUnitTestProvider != null ? GeneratorUnitTestProvider.GetHashCode() : 0);
- result = (result*397) ^ AllowDebugGeneratedFiles.GetHashCode();
- result = (result*397) ^ AllowRowTests.GetHashCode();
- return result;
+ int hashCode = (FeatureLanguage != null ? FeatureLanguage.GetHashCode() : 0);
+ hashCode = (hashCode*397) ^ (ToolLanguage != null ? ToolLanguage.GetHashCode() : 0);
+ hashCode = (hashCode*397) ^ (GeneratorUnitTestProvider != null ? GeneratorUnitTestProvider.GetHashCode() : 0);
+ hashCode = (hashCode*397) ^ AllowDebugGeneratedFiles.GetHashCode();
+ hashCode = (hashCode*397) ^ AllowRowTests.GetHashCode();
+ hashCode = (hashCode*397) ^ GenerateAsyncTests.GetHashCode();
+ hashCode = (hashCode*397) ^ (GeneratorPath != null ? GeneratorPath.GetHashCode() : 0);
+ hashCode = (hashCode*397) ^ UsesPlugins.GetHashCode();
+ return hashCode;
}
}
View
1 IdeIntegration/IdeIntegration/Options/IntegrationOptions.cs
@@ -11,6 +11,7 @@ public class IntegrationOptions
public bool EnableTracing { get; set; }
public string TracingCategories { get; set; }
public TestRunnerTool TestRunnerTool { get; set; }
+ public bool DisableRegenerateFeatureFilePopupOnConfigChange { get; set; }
}
public enum TestRunnerTool
View
5 IdeIntegration/Vs2010Integration/LanguageService/VsProjectScope.cs
@@ -265,8 +265,11 @@ private void FeatureFilesTrackerOnReady()
private void ConfirmReGenerateFilesOnConfigChange()
{
+ if (integrationOptionsProvider.GetOptions().DisableRegenerateFeatureFilePopupOnConfigChange)
+ return;
+
var questionResult = MessageBox.Show(
- "SpecFlow detected changes in the configuration that might require re-generating the feature files. Do you want to re-generate them now?",
+ "SpecFlow detected changes in the configuration that might require re-generating the feature files. You can disable this popup in the SpecFlow Visual Studio settings (\"Tools / Options / SpecFlow\")." + Environment.NewLine + "Do you want to re-generate them now?",
"SpecFlow Configuration Changes",
MessageBoxButtons.YesNo,
MessageBoxIcon.Question,
View
2 IdeIntegration/Vs2010Integration/Options/IntegrationOptionsProvider.cs
@@ -23,6 +23,7 @@ internal class IntegrationOptionsProvider : IIntegrationOptionsProvider
public const bool EnableTracingDefaultValue = false;
public const string TracingCategoriesDefaultValue = "all";
public const TestRunnerTool TestRunnerToolDefaultValue = TestRunnerTool.Auto;
+ public const bool DisableRegenerateFeatureFilePopupOnConfigChangeDefaultValue = false;
private DTE dte;
@@ -53,6 +54,7 @@ private static IntegrationOptions GetOptions(DTE dte)
EnableTracing = GetGeneralOption(dte, "EnableTracing", EnableTracingDefaultValue),
TracingCategories = GetGeneralOption(dte, "TracingCategories", TracingCategoriesDefaultValue),
TestRunnerTool = GetGeneralOption(dte, "TestRunnerTool", TestRunnerToolDefaultValue),
+ DisableRegenerateFeatureFilePopupOnConfigChange = GetGeneralOption(dte, "DisableRegenerateFeatureFilePopupOnConfigChange", DisableRegenerateFeatureFilePopupOnConfigChangeDefaultValue)
};
return options;
}
View
7 IdeIntegration/Vs2010Integration/Options/OptionsPageGeneral.cs
@@ -22,6 +22,12 @@ public class OptionsPageGeneral : DialogPage
[DefaultValue(IntegrationOptionsProvider.EnableAnalysisDefaultValue)]
public bool EnableAnalysis { get; set; }
+ [Category("Analysis Settings")]
+ [Description("Controls whether SpecFlow Visual Studio integration should offer re-generating the feature files on configuration change.")]
+ [DisplayName(@"Disable re-generate feature file popup")]
+ [DefaultValue(IntegrationOptionsProvider.DisableRegenerateFeatureFilePopupOnConfigChangeDefaultValue)]
+ public bool DisableRegenerateFeatureFilePopupOnConfigChange { get; set; }
+
private bool enableSyntaxColoring = true;
[Category("Editor Settings")]
[Description("Controls whether the different syntax elements of the feature files should be indicated in the editor.")]
@@ -95,6 +101,7 @@ public OptionsPageGeneral()
EnableTracing = IntegrationOptionsProvider.EnableTracingDefaultValue;
TracingCategories = IntegrationOptionsProvider.TracingCategoriesDefaultValue;
TestRunnerTool = IntegrationOptionsProvider.TestRunnerToolDefaultValue;
+ DisableRegenerateFeatureFilePopupOnConfigChange = IntegrationOptionsProvider.DisableRegenerateFeatureFilePopupOnConfigChangeDefaultValue;
}
}
}
View
37 Runtime/PlatformSpecific/RuntimeConfiguration.cs
@@ -149,5 +149,42 @@ private void AddCustomDependency(string implementationType, Type interfaceType,
this.CustomDependencies.Add(implementationType, interfaceType.AssemblyQualifiedName, name);
}
+
+ #region Equality members
+
+ protected bool Equals(RuntimeConfiguration other)
+ {
+ return Equals(FeatureLanguage, other.FeatureLanguage) && Equals(ToolLanguage, other.ToolLanguage) && Equals(BindingCulture, other.BindingCulture) && string.Equals(RuntimeUnitTestProvider, other.RuntimeUnitTestProvider) && DetectAmbiguousMatches.Equals(other.DetectAmbiguousMatches) && StopAtFirstError.Equals(other.StopAtFirstError) && MissingOrPendingStepsOutcome.Equals(other.MissingOrPendingStepsOutcome) && TraceSuccessfulSteps.Equals(other.TraceSuccessfulSteps) && TraceTimings.Equals(other.TraceTimings) && MinTracedDuration.Equals(other.MinTracedDuration) && StepDefinitionSkeletonStyle.Equals(other.StepDefinitionSkeletonStyle) &&
+ (AdditionalStepAssemblies ?? new List<string>()).SequenceEqual(other.AdditionalStepAssemblies ?? new List<string>());
+ }
+
+ public override bool Equals(object obj)
+ {
+ if (ReferenceEquals(null, obj)) return false;
+ if (ReferenceEquals(this, obj)) return true;
+ if (obj.GetType() != this.GetType()) return false;
+ return Equals((RuntimeConfiguration) obj);
+ }
+
+ public override int GetHashCode()
+ {
+ unchecked
+ {
+ int hashCode = (FeatureLanguage != null ? FeatureLanguage.GetHashCode() : 0);
+ hashCode = (hashCode*397) ^ (ToolLanguage != null ? ToolLanguage.GetHashCode() : 0);
+ hashCode = (hashCode*397) ^ (BindingCulture != null ? BindingCulture.GetHashCode() : 0);
+ hashCode = (hashCode*397) ^ (RuntimeUnitTestProvider != null ? RuntimeUnitTestProvider.GetHashCode() : 0);
+ hashCode = (hashCode*397) ^ DetectAmbiguousMatches.GetHashCode();
+ hashCode = (hashCode*397) ^ StopAtFirstError.GetHashCode();
+ hashCode = (hashCode*397) ^ MissingOrPendingStepsOutcome.GetHashCode();
+ hashCode = (hashCode*397) ^ TraceSuccessfulSteps.GetHashCode();
+ hashCode = (hashCode*397) ^ TraceTimings.GetHashCode();
+ hashCode = (hashCode*397) ^ MinTracedDuration.GetHashCode();
+ hashCode = (hashCode*397) ^ StepDefinitionSkeletonStyle.GetHashCode();
+ return hashCode;
+ }
+ }
+
+ #endregion
}
}
View
1 changelog.txt
@@ -4,6 +4,7 @@ Fixed issues:
+ VS2012: Run specflow scenarios does not work: works as for RC, but still runs all scenarios from the file (Issue 210)
+ VS2010: VS stops showing context menus if code window contains C++ code (Issue 209)
+ VS2010: Use < and > around variables in Intellisense for steps (Issue 203)
++ VS2010: SpecFlow incorrectly detected changes in the configuration (Issue 215)
1.9.0 - 2012/08/06

0 comments on commit 616f55a

Please sign in to comment.