Exemplo n.º 1
0
        public void ShouldCheckEquality(string minorValue1, string minorValue2, bool expectedEqualityResult)
        {
            //Given
            var firstListContent = new ListContent("Name", new[] {
                new ListItemContent("Header", "value",
                                    new ListItemContent("Subheader", "value").AsArray()),
                new ListItemContent("Header", "value",
                                    new [] { new ListItemContent("Subheader", "value"),
                                             new ListItemContent("Subheader", "value2",
                                                                 new ListItemContent("Subsubheader", minorValue1).AsArray()) })
            }
                                                   );

            var secondListContent = new ListContent("Name",
                                                    new[] { new ListItemContent("Header", "value",
                                                                                new ListItemContent("Subheader", "value").AsArray()),
                                                            new ListItemContent("Header", "value",
                                                                                new [] {
                    new ListItemContent("Subheader", "value"),
                    new ListItemContent("Subheader", "value2",
                                        new ListItemContent("Subsubheader", minorValue2).AsArray())
                }) });
            //When
            var result = firstListContent.Equals(secondListContent);

            //Then
            result.Should().Be(expectedEqualityResult);
        }
Exemplo n.º 2
0
        public void EqualsTest_CompareWithNull_NotEquals()
        {
            var firstListContent = new ListContent("Name",
                                                   new ListItemContent("Header", "value",
                                                                       new ListItemContent("Subheader", "value")),
                                                   new ListItemContent("Header", "value",
                                                                       new ListItemContent("Subheader", "value"),
                                                                       new ListItemContent("Subheader", "value",
                                                                                           new ListItemContent("Subsubheader1", "value"))));

            Assert.IsFalse(firstListContent.Equals(null));
        }
Exemplo n.º 3
0
        public void ShouldNotBeEqualToNull()
        {
            //Given
            var firstListContent = new ListContent("Name",
                                                   new[] {
                new ListItemContent("Header", "value",
                                    new ListItemContent("Subheader", "value").AsArray()),
                new ListItemContent("Header", "value",
                                    new [] {
                    new ListItemContent("Subheader", "value"),
                    new ListItemContent("Subheader", "value",
                                        new ListItemContent("Subsubheader1", "value").AsArray())
                })
            });
            //When
            var result = firstListContent.Equals(null);

            //Then
            result.Should().BeFalse();
        }
Exemplo n.º 4
0
        public void EqualsTest_ValuesAreEqual_Equals()
        {
            var firstListContent = new ListContent("Name",
                                                   new ListItemContent("Header", "value",
                                                                       new ListItemContent("Subheader", "value")),
                                                   new ListItemContent("Header", "value",
                                                                       new ListItemContent("Subheader", "value"),
                                                                       new ListItemContent("Subheader", "value2",
                                                                                           new ListItemContent("Subsubheader", "value"))));

            var secondListContent = new ListContent("Name",
                                                    new ListItemContent("Header", "value",
                                                                        new ListItemContent("Subheader", "value")),
                                                    new ListItemContent("Header", "value",
                                                                        new ListItemContent("Subheader", "value"),
                                                                        new ListItemContent("Subheader", "value2",
                                                                                            new ListItemContent("Subsubheader", "value"))));


            Assert.IsTrue(firstListContent.Equals(secondListContent));
        }
Exemplo n.º 5
0
        public void EqualsTest_ValuesDifferByNestedValue_NotEquals()
        {
            var firstListContent = new ListContent("Name",
                                                   new ListItemContent("Header", "value",
                                                                       new ListItemContent("Subheader", "value")),
                                                   new ListItemContent("Header", "value",
                                                                       new ListItemContent("Subheader", "value"),
                                                                       new ListItemContent("Subheader", "value",
                                                                                           new ListItemContent("Subsubheader1", "value"))));

            var secondListContent = new ListContent("Name",
                                                    new ListItemContent("Header", "value",
                                                                        new ListItemContent("Subheader", "value")),
                                                    new ListItemContent("Header", "value",
                                                                        new ListItemContent("Subheader", "value"),
                                                                        new ListItemContent("Subheader", "value",
                                                                                            new ListItemContent("Subsubheader2", "value"))));


            Assert.IsFalse(firstListContent.Equals(secondListContent));
        }
		public void EqualsTest_ValuesAreEqual_Equals()
		{
			var firstListContent = new ListContent("Name",
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value")),
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value"),
				new ListItemContent("Subheader", "value2",
					new ListItemContent("Subsubheader", "value"))));

			var secondListContent = new ListContent("Name",
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value")),
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value"),
				new ListItemContent("Subheader", "value2",
					new ListItemContent("Subsubheader", "value"))));


			Assert.IsTrue(firstListContent.Equals(secondListContent));
		}
		public void EqualsTest_CompareWithNull_NotEquals()
		{
			var firstListContent = new ListContent("Name",
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value")),
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value"),
				new ListItemContent("Subheader", "value",
					new ListItemContent("Subsubheader1", "value"))));
			
			Assert.IsFalse(firstListContent.Equals(null));
		}
		public void EqualsTest_ValuesDifferByNestedValue_NotEquals()
		{
			var firstListContent = new ListContent("Name",
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value")),
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value"),
				new ListItemContent("Subheader", "value",
					new ListItemContent("Subsubheader1", "value"))));

			var secondListContent = new ListContent("Name",
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value")),
			new ListItemContent("Header", "value",
				new ListItemContent("Subheader", "value"),
				new ListItemContent("Subheader", "value",
					new ListItemContent("Subsubheader2", "value"))));


			Assert.IsFalse(firstListContent.Equals(secondListContent));
		}