public void HashCode_WithRuntimeTargets(string left, string right, bool expected) { var leftSide = new LockFileTargetLibrary() { RuntimeTargets = left.Split(';').Select(e => new LockFileRuntimeTarget(e)).ToList() }; var rightSide = new LockFileTargetLibrary() { RuntimeTargets = right.Split(';').Select(e => new LockFileRuntimeTarget(e)).ToList() }; // Act & Assert if (expected) { leftSide.GetHashCode().Should().Be(rightSide.GetHashCode()); } else { leftSide.GetHashCode().Should().NotBe(rightSide.GetHashCode()); } }
public void HashCode_WithFrameworkReferences(string left, string right, bool expected) { var leftSide = new LockFileTargetLibrary() { FrameworkReferences = left.Split(';').Select(e => e).ToList() }; var rightSide = new LockFileTargetLibrary() { FrameworkReferences = right.Split(';').Select(e => e).ToList() }; // Act & Assert if (expected) { leftSide.GetHashCode().Should().Be(rightSide.GetHashCode()); } else { leftSide.GetHashCode().Should().NotBe(rightSide.GetHashCode()); } }
public void HashCode_WithPackageDependency(string left, string right, bool expected) { var leftSide = new LockFileTargetLibrary() { Dependencies = left.Split(';').Select(e => new PackageDependency(e, VersionRange.Parse("1.0.0"))).ToList() }; var rightSide = new LockFileTargetLibrary() { Dependencies = right.Split(';').Select(e => new PackageDependency(e, VersionRange.Parse("1.0.0"))).ToList() }; // Act & Assert if (expected) { leftSide.GetHashCode().Should().Be(rightSide.GetHashCode()); } else { leftSide.GetHashCode().Should().NotBe(rightSide.GetHashCode()); } }
public void HashCode_WithType(string left, string right, bool expected) { var leftSide = new LockFileTargetLibrary() { Type = left }; var rightSide = new LockFileTargetLibrary() { Type = right }; // Act & Assert if (expected) { leftSide.GetHashCode().Should().Be(rightSide.GetHashCode()); } else { leftSide.GetHashCode().Should().NotBe(rightSide.GetHashCode()); } }
public void HashCode_WithVersion(string left, string right, bool expected) { var leftSide = new LockFileTargetLibrary() { Version = NuGetVersion.Parse(left) }; var rightSide = new LockFileTargetLibrary() { Version = NuGetVersion.Parse(right) }; // Act & Assert if (expected) { leftSide.GetHashCode().Should().Be(rightSide.GetHashCode()); } else { leftSide.GetHashCode().Should().NotBe(rightSide.GetHashCode()); } }
public void HashCode_WithPackageType_IsIgnored() { var leftSide = new LockFileTargetLibrary() { PackageType = new List <PackageType>() { PackageType.Dependency } }; var rightSide = new LockFileTargetLibrary() { PackageType = new List <PackageType>() { PackageType.DotnetCliTool } }; leftSide.GetHashCode().Should().Be(rightSide.GetHashCode()); }