public void DictionaryEquals_CompareSameDicts_ReturnsTrue() { // Arrange var dict = new Dictionary <int, string>(); // Act & Assert EqualityUtility.DictionaryEquals(dict, dict).Should().BeTrue(); }
public void DictionaryEquals_CompareWithNullDict_ReturnsFalse() { // Arrange var dict = new Dictionary <int, string>(); // Act & Assert EqualityUtility.DictionaryEquals(dict, null).Should().BeFalse(); }
public bool Equals(NodeWarningProperties other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(EqualityUtility.SetEqualsWithNullCheck(ProjectWide, other.ProjectWide) && EqualityUtility.DictionaryEquals(PackageSpecific, other.PackageSpecific, (s, o) => EqualityUtility.SetEqualsWithNullCheck(s, o))); }
public void DictionaryEquals_CompareEquivalentDicts_ReturnsTrue() { // Arrange var dict1 = new Dictionary <int, string>() { { 1, "unit.test" } }; var dict2 = new Dictionary <int, string>() { { 1, "unit.test" } }; // Act & Assert EqualityUtility.DictionaryEquals(dict1, dict2).Should().BeTrue(); }
public void DictionaryEquals_CompareTwoDictsWithDifferentLengths_ReturnsFalse() { // Arrange var dict1 = new Dictionary <int, string>() { { 1, "unit.test" }, { 2, "unit" } }; var dict2 = new Dictionary <int, string>() { { 1, "unit.test" } }; // Act & Assert EqualityUtility.DictionaryEquals(dict1, dict2).Should().BeFalse(); }
public bool Equals(PackageSpecificWarningProperties other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(EqualityUtility.DictionaryEquals( Properties, other.Properties, (sv1, ov1) => EqualityUtility.DictionaryEquals(sv1, ov1, (sv2, ov2) => EqualityUtility.SetEqualsWithNullCheck(sv2, ov2)))); }
public bool Equals(PackageSpec other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } // Name and FilePath are not used for comparison since they are not serialized to JSON. return(Title == other.Title && EqualityUtility.EqualsWithNullCheck(Version, other.Version) && IsDefaultVersion == other.IsDefaultVersion && HasVersionSnapshot == other.HasVersionSnapshot && Description == other.Description && Summary == other.Summary && ReleaseNotes == other.ReleaseNotes && EqualityUtility.SequenceEqualWithNullCheck(Authors, other.Authors) && EqualityUtility.SequenceEqualWithNullCheck(Owners, other.Owners) && ProjectUrl == other.ProjectUrl && IconUrl == other.IconUrl && LicenseUrl == other.LicenseUrl && RequireLicenseAcceptance == other.RequireLicenseAcceptance && Copyright == other.Copyright && Language == other.Language && EqualityUtility.EqualsWithNullCheck(BuildOptions, other.BuildOptions) && EqualityUtility.SequenceEqualWithNullCheck(Tags, other.Tags) && EqualityUtility.SequenceEqualWithNullCheck(ContentFiles, other.ContentFiles) && EqualityUtility.SequenceEqualWithNullCheck(Dependencies, other.Dependencies) && EqualityUtility.DictionaryOfSequenceEquals(Scripts, other.Scripts) && EqualityUtility.DictionaryEquals(PackInclude, other.PackInclude, (s, o) => StringComparer.Ordinal.Equals(s, o)) && EqualityUtility.EqualsWithNullCheck(PackOptions, other.PackOptions) && EqualityUtility.SequenceEqualWithNullCheck(TargetFrameworks, other.TargetFrameworks) && EqualityUtility.EqualsWithNullCheck(RuntimeGraph, other.RuntimeGraph) && EqualityUtility.EqualsWithNullCheck(RestoreMetadata, other.RestoreMetadata)); }