コード例 #1
0
        public void DictionaryEquals_CompareSameDicts_ReturnsTrue()
        {
            // Arrange
            var dict = new Dictionary <int, string>();

            // Act & Assert
            EqualityUtility.DictionaryEquals(dict, dict).Should().BeTrue();
        }
コード例 #2
0
        public void DictionaryEquals_CompareWithNullDict_ReturnsFalse()
        {
            // Arrange
            var dict = new Dictionary <int, string>();

            // Act & Assert
            EqualityUtility.DictionaryEquals(dict, null).Should().BeFalse();
        }
コード例 #3
0
            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)));
            }
コード例 #4
0
        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();
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        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))));
        }
コード例 #7
0
ファイル: PackageSpec.cs プロジェクト: suneg/NuGet.Client
        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));
        }