Пример #1
0
    public void Parse(string toParse, string expectedParsed)
    {
        var reader  = A.Dummy <XmlReader>();
        var context = A.Dummy <IParsingContext>();

        var parser = new NameTextParser();
        var actual = parser.Parse(reader, context, toParse);

        actual.Should().Be(expectedParsed);
    }
Пример #2
0
    public void MaxLength(string toParse)
    {
        var errorMessage = $"O texto contém {toParse.Length} caracteres, o que excede a quantidade máxima de 64.";

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

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

        var parser = new NameTextParser();
        var ret    = parser.Parse(reader, context, toParse);

        ret.Should().BeNull();

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