public void InvalidCondition() { const string message = "Condição 'while' inválida. Gibberish"; var reader = CreateReader("<t while=\"abc\" />"); var context = A.Fake <IParsingContext>(i => i.Strict()); A.CallTo(() => context.LogError(reader, message)).DoesNothing(); var parsedCondition = A.Fake <IParsedCondition>(i => i.Strict()); A.CallTo(() => parsedCondition.Condition).Returns(null); A.CallTo(() => parsedCondition.Message).Returns("Gibberish"); var parser = A.Fake <IConditionParser>(i => i.Strict()); A.CallTo(() => parser.Parse("abc")).Returns(parsedCondition); var sut = new WhileAttributeParser(parser); var result = sut.Parse(reader, context); result.Should().BeNull(); A.CallTo(() => context.LogError(reader, message)).MustHaveHappenedOnceExactly(); }
public void ValidCondition() { var reader = CreateReader("<t while=\"abc\" />"); var context = A.Fake <IParsingContext>(i => i.Strict()); var parsedCondition = A.Dummy <IParsedCondition>(); var parser = A.Fake <IConditionParser>(i => i.Strict()); A.CallTo(() => parser.Parse("abc")).Returns(parsedCondition); var sut = new WhileAttributeParser(parser); var result = sut.Parse(reader, context); result.Should().BeOfType <WhileAttribute>() .Which.Condition.Should().BeSameAs(parsedCondition.Condition); }
public void AttributetName() { var sut = new WhileAttributeParser(A.Dummy <IConditionParser>()); sut.Name.Should().Be("while"); }