public void Equals_Failure_ObjectType()
        {
            // arrange
            HTMLParserFeedItemDefinition definition = new HTMLParserFeedItemDefinition();
            object failureObject = new object();

            // act
            bool actual = definition.Equals(failureObject);

            // assert
            Assert.IsFalse(actual);
        }
        public void Equals_Success()
        {
            // arrange
            HTMLParserFeedItemDefinition definition = new HTMLParserFeedItemDefinition();
            HTMLParserFeedItemDefinition duplicate = new HTMLParserFeedItemDefinition();
            string tag = "Equals_Success";
            string attributeName = "Attribute Name";

            definition.Tag = tag;
            definition.AttributeName = attributeName;

            duplicate.Tag = tag.ToUpper();
            duplicate.AttributeName = attributeName.ToUpper();

            // act
            bool actual = definition.Equals(duplicate);

            // assert
            Assert.IsTrue(actual);
        }
        public void Equals_Failure()
        {
            // arrange
            HTMLParserFeedItemDefinition definition = new HTMLParserFeedItemDefinition();
            HTMLParserFeedItemDefinition duplicate = new HTMLParserFeedItemDefinition();
            string tag = "Equals_Failure";
            string attributeName = "Attribute Equals_Failure";

            definition.Tag = tag + "1";
            definition.AttributeName = attributeName + "1";

            duplicate.Tag = tag.ToUpper();
            duplicate.AttributeName = attributeName.ToUpper();

            // act
            bool actual = definition.Equals(duplicate);

            // assert
            Assert.IsFalse(actual);
        }
Пример #4
0
        public void GetRSSFeedPropertyDefinitionTest_RegionName_Success4()
        {
            // arrange
            string uriPrefix = string.Empty;
            HtmlParser target = new HtmlParser(uriPrefix);

            string itemAttributeName = "MainContent_tcStatus_tpAllStatusToday_gvAllStatusToday_lblRegionName_0";
            HTMLParserFeedItemDefinition expected = new HTMLParserFeedItemDefinition() { Tag = "span", AttributeName = "RegionName", ReturnAttributeName = null, Name = HTMLParserFeedItemType.LocationName, ContentType = ContentTag.InnerHtml };
            HTMLParserFeedItemDefinition actual;

            // act
            actual = target.GetRSSFeedPropertyDefinition(target.HtmlDefinitions.ToList(), itemAttributeName);

            // assert
            Assert.AreEqual(target.HtmlDefinitions[3], actual);
        }
        public void GetHashCode_JustAttributeName()
        {
            // arrange
            HTMLParserFeedItemDefinition definition = new HTMLParserFeedItemDefinition();
            definition.AttributeName = "AttributeName";
            int expected = definition.AttributeName.GetHashCode() + string.Empty.GetHashCode();

            // act
            int actual = definition.GetHashCode();

            // assert
            Assert.IsTrue(expected == actual);
        }
        public void GetHashCode_Success()
        {
            // arrange
            HTMLParserFeedItemDefinition definition = new HTMLParserFeedItemDefinition();

            definition.Tag = "GetHashCode_Success";
            definition.AttributeName = "AttributeName";

            int expected = definition.Tag.GetHashCode() + definition.AttributeName.GetHashCode();

            // act
            int actual = definition.GetHashCode();

            // assert
            Assert.IsTrue(expected == actual);
        }
        public void GetHashCode_JustTag()
        {
            // arrange
            HTMLParserFeedItemDefinition definition = new HTMLParserFeedItemDefinition();
            definition.Tag = "GetHashCode_JustTag";
            int expected = definition.Tag.GetHashCode() + string.Empty.GetHashCode();

            // act
            int actual = definition.GetHashCode();

            // assert
            Assert.IsTrue(expected == actual);
        }