Пример #1
0
    public void A_FetchedDocument_should_be_equal_to_a_different_one()
    {
        var sut   = new FetchedDocument(Encoding.UTF8.GetBytes("foo"));
        var other = new FetchedDocument(Encoding.UTF8.GetBytes("bar"));

        sut.Equals(other).Should().BeFalse();
    }
Пример #2
0
    public void A_FetchedDocument_should_be_equal_to_an_identical_one()
    {
        var sut   = new FetchedDocument(Encoding.UTF8.GetBytes("foo"));
        var other = new FetchedDocument(Encoding.UTF8.GetBytes("foo"));

        sut.Equals(other).Should().BeTrue();
    }
    public void Should_extract_single_tag()
    {
        var body = WaffleBuilder.GenerateParagraph();
        var html = WaffleBuilder.GeneratePageAsString(body);

        var sut = new FetchedDocument(Encoding.UTF8.GetBytes(html));

        var content = sut.ElementSelector("body");

        content.Trim().Should().NotBeNull()
        .And.Be(body.Trim());
    }
    public void Should_extract_multiple_tags()
    {
        var body = WaffleBuilder.GenerateParagraph(samples: 3, small: true);
        var html = WaffleBuilder.GeneratePageAsString(body);

        var sut = new FetchedDocument(Encoding.UTF8.GetBytes(html));

        var contents = sut.ElementSelectorAll("p");

        contents.Should().NotBeNullOrEmpty()
        .And.HaveCount(3);
    }
Пример #5
0
    public void An_empty_FetchedDocument_should_be_equal_to_Empty_value()
    {
        var sut = new FetchedDocument(new byte[] {});

        sut.Equals(FetchedDocument.Empty).Should().BeTrue();
    }