示例#1
0
    public void Parse(string value, string expected)
    {
        var reader  = A.Dummy <XmlReader>();
        var context = A.Dummy <IParsingContext>();

        var sut    = new BackgroundImageTextParser();
        var actual = sut.Parse(reader, context, value);

        actual.Should().Be(expected);
    }
示例#2
0
    public void InvalidCharacters(string value)
    {
        var message = $"O texto '{value}' contém caracteres inválidos.";

        var reader  = A.Dummy <XmlReader>();
        var context = A.Fake <IParsingContext>();

        A.CallTo(() => context.LogError(reader, message)).DoesNothing();

        var sut    = new BackgroundImageTextParser();
        var actual = sut.Parse(reader, context, value);

        actual.Should().BeNull();

        A.CallTo(() => context.LogError(reader, message)).MustHaveHappenedOnceExactly();
    }
示例#3
0
    public void TextTooLong()
    {
        var value   = "12345678901234567890123456789012345678901234567890123456789012345";
        var message = $"O texto contém 65 caracteres, o que excede a quantidade máxima de 64.";

        var reader  = A.Dummy <XmlReader>();
        var context = A.Fake <IParsingContext>();

        A.CallTo(() => context.LogError(reader, message)).DoesNothing();

        var sut    = new BackgroundImageTextParser();
        var actual = sut.Parse(reader, context, value);

        actual.Should().BeNull();

        A.CallTo(() => context.LogError(reader, message)).MustHaveHappenedOnceExactly();
    }