Esempio n. 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);
        }
Esempio n. 3
0
        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);
        }
Esempio n. 4
0
        public void GetHashCode_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 stubPhXml4 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Custom, Index = 1
            };
            var stubPhXml5 = new PlaceholderData {
                PlaceholderType = PlaceholderType.Custom, Index = 2
            };
            var phSl3 = new PlaceholderLocationData(stubPhXml3);
            var phSl4 = new PlaceholderLocationData(stubPhXml4);
            var phSl5 = new PlaceholderLocationData(stubPhXml5);

            // ACT
            var hash1 = phSl1.GetHashCode();
            var hash2 = phSl2.GetHashCode();
            var hash3 = phSl3.GetHashCode();
            var hash4 = phSl4.GetHashCode();
            var hash5 = phSl5.GetHashCode();

            // ASSERT
            Assert.Equal(hash1, hash2);
            Assert.Equal(hash3, hash4);
            Assert.NotEqual(hash3, hash5);
        }
 public PlaceholderTransform(PlaceholderLocationData placeholderLocationData)
 {
     _placeholderLocationData = placeholderLocationData;
 }