public void Should_ParseCategoryNode()
      {
         // Arrange
         var categoryNode = Mock.Of<INode>();
         var nodeSelector = Mock.Of<INodeSelector>(x => x.SelectNode(It.IsAny<INode>(), It.IsAny<string>()).InnerText == string.Empty);

         var sut = new PluralsightNodeParser(SiteUrl, nodeSelector);

         // Act
         var result = sut.ParseCategoryNode(categoryNode);

         // Assert
         Assert.NotNull(result);
         Mock.Get(nodeSelector).Verify(x => x.SelectNode(It.IsAny<INode>(), It.IsAny<string>()).InnerText, Times.Once);
         Mock.Get(categoryNode).Verify(x => x.GetAttributeValue(It.IsAny<string>()), Times.Once);
      }
Esempio n. 2
0
        public void Should_ParseCategoryNode()
        {
            // Arrange
            var categoryNode = Mock.Of <INode>();
            var nodeSelector = Mock.Of <INodeSelector>(x => x.SelectNode(It.IsAny <INode>(), It.IsAny <string>()).InnerText == string.Empty);

            var sut = new PluralsightNodeParser(SiteUrl, nodeSelector);

            // Act
            var result = sut.ParseCategoryNode(categoryNode);

            // Assert
            Assert.NotNull(result);
            Mock.Get(nodeSelector).Verify(x => x.SelectNode(It.IsAny <INode>(), It.IsAny <string>()).InnerText, Times.Once);
            Mock.Get(categoryNode).Verify(x => x.GetAttributeValue(It.IsAny <string>()), Times.Once);
        }
      public void Should_ThrowArgumentNullException_When_ArgumentIsNull()
      {
         global::System.Threading.Tasks.Task test = null;
         Assert.Throws<ArgumentNullException>(() => new PluralsightNodeParser(null, null));

         var sut = new PluralsightNodeParser(SiteUrl, _nodeSelector);

         Assert.Throws<ArgumentNullException>(() => sut.ParseCategoryNode(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseCategoryIdInHtmlDocument(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseSketchNode(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseCourseInfo(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseAuthor(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseAuthorFullName(null));
         Assert.Throws<ArgumentNullException>(() => sut.IsCoAuthorNode(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseCoAuthors(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseCourseLevel(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseCourseRating(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseCourseDuration(null));
         Assert.Throws<ArgumentNullException>(() => sut.ParseCourseReleaseDate(null));
      }
Esempio n. 4
0
        public void Should_ThrowArgumentNullException_When_ArgumentIsNull()
        {
            global::System.Threading.Tasks.Task test = null;
            Assert.Throws <ArgumentNullException>(() => new PluralsightNodeParser(null, null));

            var sut = new PluralsightNodeParser(SiteUrl, _nodeSelector);

            Assert.Throws <ArgumentNullException>(() => sut.ParseCategoryNode(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseCategoryIdInHtmlDocument(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseSketchNode(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseCourseInfo(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseAuthor(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseAuthorFullName(null));
            Assert.Throws <ArgumentNullException>(() => sut.IsCoAuthorNode(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseCoAuthors(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseCourseLevel(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseCourseRating(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseCourseDuration(null));
            Assert.Throws <ArgumentNullException>(() => sut.ParseCourseReleaseDate(null));
        }