Beispiel #1
0
        public void Equals_Test_Case1()
        {
            // ARRANGE
            var stubPhXml1 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Title
            };
            var phSl1      = new PlaceholderLocationData(stubPhXml1);
            var stubPhXml2 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Title
            };
            var phSl2      = new PlaceholderLocationData(stubPhXml2);
            var stubPhXml3 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Custom, Index = 1
            };
            var phSl3 = new PlaceholderLocationData(stubPhXml3);
            var phSl4 = new PlaceholderLocationData(stubPhXml3);

            // ACT
            var isEquals1 = phSl1.Equals(phSl2);
            var isEquals2 = phSl1.Equals(phSl3);
            var isEquals3 = phSl3.Equals(phSl4);

            // ASSERT
            Assert.True(isEquals1);
            Assert.False(isEquals2);
            Assert.True(isEquals3);
        }
        public void Equals_ReturnsFalse_WhenPlaceholdersAreNotSame()
        {
            // Arrange
            var phData1 = new PlaceholderData {
                Index = 4, PlaceholderType = PlaceholderType.Custom
            };
            var phData2 = new PlaceholderData {
                Index = 4, PlaceholderType = PlaceholderType.SlideNumber
            };
            var phData3 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Title
            };
            var phData4 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Custom, Index = 1
            };
            var phData5 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Custom, Index = 2
            };
            var phLocationData1 = new PlaceholderLocationData(phData3);
            var phLocationData2 = new PlaceholderLocationData(phData4);
            var phLocationData3 = new PlaceholderLocationData(phData5);

            // Act
            var isEqualsCase1 = phLocationData1.Equals(phLocationData2);
            var isEqualsCase2 = phData1.Equals(phData2);
            var isEqualsCase3 = phLocationData2.Equals(phLocationData3);

            // Assert
            Assert.False(isEqualsCase1);
            Assert.False(isEqualsCase2);
            Assert.False(isEqualsCase3);
        }
        public void Equals_Test()
        {
            // ARRANGE
            var stubPhXml1 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Title
            };
            var phSl1      = new PlaceholderLocationData(stubPhXml1);
            var stubPhXml2 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Title
            };
            var phSl2      = new PlaceholderLocationData(stubPhXml2);
            var stubPhXml3 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Custom, Index = 1
            };
            var phSl3  = new PlaceholderLocationData(stubPhXml3);
            var phSl4  = new PlaceholderLocationData(stubPhXml3);
            var custom = new PlaceholderData
            {
                Index           = 4,
                PlaceholderType = PlaceholderType.Custom
            };
            var sldNum = new PlaceholderData
            {
                Index           = 4,
                PlaceholderType = PlaceholderType.SlideNumber
            };

            // ACT
            var isEquals1 = phSl1.Equals(phSl2);
            var isEquals2 = phSl1.Equals(phSl3);
            var isEquals3 = phSl3.Equals(phSl4);
            var isEquals4 = custom.Equals(sldNum);

            // ASSERT
            Assert.True(isEquals1);
            Assert.False(isEquals2);
            Assert.True(isEquals3);
            Assert.False(isEquals4);
        }