diff --git a/Deveroom.VisualStudio.Package/Deveroom.VisualStudio.Package.csproj b/Deveroom.VisualStudio.Package/Deveroom.VisualStudio.Package.csproj index ead7e0c..410d464 100644 --- a/Deveroom.VisualStudio.Package/Deveroom.VisualStudio.Package.csproj +++ b/Deveroom.VisualStudio.Package/Deveroom.VisualStudio.Package.csproj @@ -81,7 +81,6 @@ - diff --git a/Deveroom.VisualStudio/Configuration/DeveroomConfiguration.cs b/Deveroom.VisualStudio/Configuration/DeveroomConfiguration.cs index f29e8b7..0baea7e 100644 --- a/Deveroom.VisualStudio/Configuration/DeveroomConfiguration.cs +++ b/Deveroom.VisualStudio/Configuration/DeveroomConfiguration.cs @@ -1,11 +1,9 @@ using System; -using Equ; namespace Deveroom.VisualStudio.Configuration { - public class DeveroomConfiguration: MemberwiseEquatable + public class DeveroomConfiguration { - [MemberwiseEqualityIgnore] public DateTime ConfigurationChangeTime { get; set; } = DateTime.MinValue; public string ConfigurationBaseFolder { get; set; } @@ -38,5 +36,36 @@ public void CheckConfiguration() Traceability.CheckConfiguration(); } + #region Equality + + protected bool Equals(DeveroomConfiguration other) + { + return string.Equals(ConfigurationBaseFolder, other.ConfigurationBaseFolder) && Equals(SpecFlow, other.SpecFlow) && Equals(Traceability, other.Traceability) && ProcessorArchitecture == other.ProcessorArchitecture && DebugConnector == other.DebugConnector && string.Equals(DefaultFeatureLanguage, other.DefaultFeatureLanguage) && string.Equals(ConfiguredBindingCulture, other.ConfiguredBindingCulture); + } + + 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((DeveroomConfiguration) obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = (ConfigurationBaseFolder != null ? ConfigurationBaseFolder.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (SpecFlow != null ? SpecFlow.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (Traceability != null ? Traceability.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (int) ProcessorArchitecture; + hashCode = (hashCode * 397) ^ DebugConnector.GetHashCode(); + hashCode = (hashCode * 397) ^ (DefaultFeatureLanguage != null ? DefaultFeatureLanguage.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (ConfiguredBindingCulture != null ? ConfiguredBindingCulture.GetHashCode() : 0); + return hashCode; + } + } + + #endregion } } diff --git a/Deveroom.VisualStudio/Configuration/SpecFlowConfiguration.cs b/Deveroom.VisualStudio/Configuration/SpecFlowConfiguration.cs index 784bd64..0dd0749 100644 --- a/Deveroom.VisualStudio/Configuration/SpecFlowConfiguration.cs +++ b/Deveroom.VisualStudio/Configuration/SpecFlowConfiguration.cs @@ -3,11 +3,10 @@ using System.Text.RegularExpressions; using Deveroom.VisualStudio.Common; using Deveroom.VisualStudio.ProjectSystem.Settings; -using Equ; namespace Deveroom.VisualStudio.Configuration { - public class SpecFlowConfiguration: MemberwiseEquatable + public class SpecFlowConfiguration { public bool? IsSpecFlowProject { get; set; } @@ -28,5 +27,35 @@ public void CheckConfiguration() if (Version != null && !Regex.IsMatch(Version, @"^(?:\.?[0-9]+){2,}(?:\-[\-a-z0-9]*)?$")) throw new DeveroomConfigurationException("'specFlow/version' was not in a correct format"); } + + #region Equality + + protected bool Equals(SpecFlowConfiguration other) + { + return IsSpecFlowProject == other.IsSpecFlowProject && string.Equals(Version, other.Version) && string.Equals(GeneratorFolder, other.GeneratorFolder) && string.Equals(ConfigFilePath, other.ConfigFilePath) && Equals(Traits, other.Traits); + } + + 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((SpecFlowConfiguration) obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = IsSpecFlowProject.GetHashCode(); + hashCode = (hashCode * 397) ^ (Version != null ? Version.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (GeneratorFolder != null ? GeneratorFolder.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (ConfigFilePath != null ? ConfigFilePath.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (Traits != null ? Traits.GetHashCode() : 0); + return hashCode; + } + } + + #endregion } } diff --git a/Deveroom.VisualStudio/Configuration/TagLinkConfiguration.cs b/Deveroom.VisualStudio/Configuration/TagLinkConfiguration.cs index e8fca1f..206e3d9 100644 --- a/Deveroom.VisualStudio/Configuration/TagLinkConfiguration.cs +++ b/Deveroom.VisualStudio/Configuration/TagLinkConfiguration.cs @@ -5,11 +5,10 @@ using System.Text.RegularExpressions; using System.Threading.Tasks; using Deveroom.VisualStudio.Common; -using Equ; namespace Deveroom.VisualStudio.Configuration { - public class TagLinkConfiguration : MemberwiseEquatable + public class TagLinkConfiguration { public string TagPattern { get; set; } public string UrlTemplate { get; set; } @@ -39,5 +38,33 @@ public void CheckConfiguration() throw new DeveroomConfigurationException($"Invalid regular expression '{TagPattern}' was specified as 'traceability/tagLinks[]/tagPattern': {e.Message}"); } } + + #region Equality + + protected bool Equals(TagLinkConfiguration other) + { + return string.Equals(TagPattern, other.TagPattern) && string.Equals(UrlTemplate, other.UrlTemplate) && Equals(ResolvedTagPattern, other.ResolvedTagPattern); + } + + 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((TagLinkConfiguration) obj); + } + + public override int GetHashCode() + { + unchecked + { + var hashCode = (TagPattern != null ? TagPattern.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (UrlTemplate != null ? UrlTemplate.GetHashCode() : 0); + hashCode = (hashCode * 397) ^ (ResolvedTagPattern != null ? ResolvedTagPattern.GetHashCode() : 0); + return hashCode; + } + } + + #endregion } } diff --git a/Deveroom.VisualStudio/Configuration/TraceabilityConfiguration.cs b/Deveroom.VisualStudio/Configuration/TraceabilityConfiguration.cs index db67e89..be133f9 100644 --- a/Deveroom.VisualStudio/Configuration/TraceabilityConfiguration.cs +++ b/Deveroom.VisualStudio/Configuration/TraceabilityConfiguration.cs @@ -3,11 +3,10 @@ using System.Linq; using System.Text; using System.Threading.Tasks; -using Equ; namespace Deveroom.VisualStudio.Configuration { - public class TraceabilityConfiguration : MemberwiseEquatable + public class TraceabilityConfiguration { public TagLinkConfiguration[] TagLinks { get; set; } = new TagLinkConfiguration[0]; @@ -25,5 +24,27 @@ public void CheckConfiguration() tagLinkConfiguration.CheckConfiguration(); } } + + #region Equality + + protected bool Equals(TraceabilityConfiguration other) + { + return Equals(TagLinks, other.TagLinks); + } + + 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((TraceabilityConfiguration) obj); + } + + public override int GetHashCode() + { + return (TagLinks != null ? TagLinks.GetHashCode() : 0); + } + + #endregion } } diff --git a/Deveroom.VisualStudio/Deveroom.VisualStudio.csproj b/Deveroom.VisualStudio/Deveroom.VisualStudio.csproj index a9cc089..4da89fc 100644 --- a/Deveroom.VisualStudio/Deveroom.VisualStudio.csproj +++ b/Deveroom.VisualStudio/Deveroom.VisualStudio.csproj @@ -12,7 +12,6 @@ -