示例#1
0
        public void Should_ThrowCatalogNodeParseException_When_CourseDurationNodeHasIncorrectData(string invalidData)
        {
            var durationNode = Mock.Of <INode>(n => n.InnerText == invalidData);

            var sut = new PluralsightNodeParser(SiteUrl, _nodeSelector);

            Assert.Throws <NodeParseException>(() => sut.ParseCourseDuration(durationNode));
        }
示例#2
0
        public void Should_ParseCourseDurationNode()
        {
            // Arrange
            var expected = TimeSpan.FromHours(2.5);
            var nodeData = string.Format(DateTimeFormatInfo.InvariantInfo, "[{0:T}]", expected);

            var durationNode = Mock.Of <INode>(n => n.InnerText == nodeData);

            var sut = new PluralsightNodeParser(SiteUrl, _nodeSelector);

            // Act
            var result = sut.ParseCourseDuration(durationNode);

            // Assert
            Assert.Equal(expected, result);
        }
      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));
      }
示例#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));
        }
      public void Should_ThrowCatalogNodeParseException_When_CourseDurationNodeHasIncorrectData(string invalidData)
      {
         var durationNode = Mock.Of<INode>(n => n.InnerText == invalidData);

         var sut = new PluralsightNodeParser(SiteUrl, _nodeSelector);

         Assert.Throws<NodeParseException>(() => sut.ParseCourseDuration(durationNode));
      }
      public void Should_ParseCourseDurationNode()
      {
         // Arrange
         var expected = TimeSpan.FromHours(2.5);
         var nodeData = string.Format(DateTimeFormatInfo.InvariantInfo, "[{0:T}]", expected);

         var durationNode = Mock.Of<INode>(n => n.InnerText == nodeData);

         var sut = new PluralsightNodeParser(SiteUrl, _nodeSelector);

         // Act
         var result = sut.ParseCourseDuration(durationNode);

         // Assert
         Assert.Equal(expected, result);
      }