public void GetHashCodeWorksCorrectly() { var path = new FileSystemPath("Hello"); path.GetHashCode().Should().Be(path.GetHashCode()); Func <string, int> hash = s => new FileSystemPath(s).GetHashCode(); hash("Hello").Should().Be(hash("Hello")); hash("Hello").Should().Be(hash("HELLO")); hash("Hello").Should().NotBe(hash("Hello ")); }
public override int GetHashCode() { unchecked { var hashCode = Range.GetHashCode(); hashCode = (hashCode * 397) ^ FileSystemPath.GetHashCode(); hashCode = (hashCode * 397) ^ (int)ProgramType; return(hashCode); } }
public void GetHashCodeWorksCorrectly() { var path = new FileSystemPath("Hello"); path.GetHashCode().Should().Be(path.GetHashCode()); Func<string, int> hash = s => new FileSystemPath(s).GetHashCode(); hash("Hello").Should().Be(hash("Hello")); hash("Hello").Should().Be(hash("HELLO")); hash("Hello").Should().NotBe(hash("Hello ")); }