Example #1
0
        public void GetHashCode_NestedUnequalMarkupExtension_Unequal()
        {
            // Arrange
            var arguments1 = new[]
            {
                MarkupExtensionInfoTests.CreateArgument(null, "S1"),
                MarkupExtensionInfoTests.CreateArgument(null, new MarkupExtensionInfo("TypeName", new[] { MarkupExtensionInfoTests.CreateArgument("M", "S") })),
                MarkupExtensionInfoTests.CreateArgument("M1", "S3"),
                MarkupExtensionInfoTests.CreateArgument("M2", "S4")
            };

            var arguments2 = new[]
            {
                MarkupExtensionInfoTests.CreateArgument(null, "S1"),
                MarkupExtensionInfoTests.CreateArgument(null, new MarkupExtensionInfo("TypeName", new[] { MarkupExtensionInfoTests.CreateArgument("N", "S") })),
                MarkupExtensionInfoTests.CreateArgument("M1", "S3"),
                MarkupExtensionInfoTests.CreateArgument("M2", "S4")
            };

            var @this = new MarkupExtensionInfo("TypeName", arguments1);
            var other = new MarkupExtensionInfo("TypeName", arguments2);

            // Act
            var hash1 = @this.GetHashCode();
            var hash2 = other.GetHashCode();

            // Assert
            Assert.AreNotEqual(hash1, hash2);
        }
Example #2
0
        public void GetHashCode_ToIdenticalWithArguments_Equal()
        {
            // Arrange
            var arguments1 = new[]
            {
                MarkupExtensionInfoTests.CreateArgument(null, "S1"),
                MarkupExtensionInfoTests.CreateArgument(null, "S2"),
                MarkupExtensionInfoTests.CreateArgument("M1", "S3"),
                MarkupExtensionInfoTests.CreateArgument("M2", "S4")
            };

            var arguments2 = new[]
            {
                MarkupExtensionInfoTests.CreateArgument(null, "S1"),
                MarkupExtensionInfoTests.CreateArgument(null, "S2"),
                MarkupExtensionInfoTests.CreateArgument("M1", "S3"),
                MarkupExtensionInfoTests.CreateArgument("M2", "S4")
            };

            var @this = new MarkupExtensionInfo("TypeName", arguments1);
            var other = new MarkupExtensionInfo("TypeName", arguments2);

            // Act
            var hash1 = @this.GetHashCode();
            var hash2 = other.GetHashCode();

            // Assert
            Assert.AreEqual(hash1, hash2);
        }
Example #3
0
        public void Equals_NestedUnequalMarkupExtension_Unequal()
        {
            // Arrange
            var arguments1 = new[]
            {
                MarkupExtensionInfoTests.CreateArgument(null, "S1"),
                MarkupExtensionInfoTests.CreateArgument(null, new MarkupExtensionInfo("TypeName", new[] { MarkupExtensionInfoTests.CreateArgument("M", "S") })),
                MarkupExtensionInfoTests.CreateArgument("M1", "S3"),
                MarkupExtensionInfoTests.CreateArgument("M2", "S4")
            };

            var arguments2 = new[]
            {
                MarkupExtensionInfoTests.CreateArgument(null, "S1"),
                MarkupExtensionInfoTests.CreateArgument(null, new MarkupExtensionInfo("TypeName", new[] { MarkupExtensionInfoTests.CreateArgument("N", "S") })),
                MarkupExtensionInfoTests.CreateArgument("M1", "S3"),
                MarkupExtensionInfoTests.CreateArgument("M2", "S4")
            };

            var @this = new MarkupExtensionInfo("TypeName", arguments1);
            var other = new MarkupExtensionInfo("TypeName", arguments2);

            // Act
            var equal = @this.Equals(other);

            // Assert
            Assert.IsFalse(equal);
        }
Example #4
0
        public void Equals_ToIdenticalWithArguments_Equal()
        {
            // Arrange
            var arguments1 = new[]
            {
                MarkupExtensionInfoTests.CreateArgument(null, "S1"),
                MarkupExtensionInfoTests.CreateArgument(null, "S2"),
                MarkupExtensionInfoTests.CreateArgument("M1", "S3"),
                MarkupExtensionInfoTests.CreateArgument("M2", "S4")
            };

            var arguments2 = new[]
            {
                MarkupExtensionInfoTests.CreateArgument(null, "S1"),
                MarkupExtensionInfoTests.CreateArgument(null, "S2"),
                MarkupExtensionInfoTests.CreateArgument("M1", "S3"),
                MarkupExtensionInfoTests.CreateArgument("M2", "S4")
            };

            var @this = new MarkupExtensionInfo("TypeName", arguments1);
            var other = new MarkupExtensionInfo("TypeName", arguments2);

            // Act
            var equal = @this.Equals(other);

            // Assert
            Assert.IsTrue(equal);
        }
Example #5
0
        public void CreateInstance_ArgumentsParameter_CopiesArguments()
        {
            // Arrange
            var arguments = new[]
            {
                MarkupExtensionInfoTests.CreateArgument(null, "S1"),
                MarkupExtensionInfoTests.CreateArgument(null, "S2"),
                MarkupExtensionInfoTests.CreateArgument("M1", "S3"),
                MarkupExtensionInfoTests.CreateArgument("M2", "S4")
            }.ToList();

            // Act
            var target = new MarkupExtensionInfo("TypeName", arguments);

            // Assert
            Assert.AreNotEqual(arguments, target.Arguments);
            Assert.IsTrue(arguments.SequenceEqual(target.Arguments));
        }