public void Failure(string text, string errorMessage) { var sut = new TextSourceParser(); var result = sut.Parse(text); result.IsError.Should().BeTrue(); result.ErrorMessage.Should().Be(errorMessage); }
public void InterpolatorWithoutVariables(string text, params string[] interpolatorValues) { var sut = new TextSourceParser(); var result = sut.Parse(text); result.IsError.Should().BeFalse(); result.TextSource.Should().BeOfType <TextSource>() .Which.Interpolator.Should().BeOfType <Interpolator>() .Which.Values.Should().BeEquivalentTo( interpolatorValues.Select(i => new { IsVariable = false, Value = i }) ); }
public void Success(string text, string expected = null) { if (expected is null) { expected = text; } var sut = new TextSourceParser(); var result = sut.Parse(text); result.IsError.Should().BeFalse(); result.TextSource.ToString().Should().Be(expected); }
public void NoInterpolator(string text, string expected = null) { if (expected is null) { expected = text; } var sut = new TextSourceParser(); var result = sut.Parse(text); result.IsError.Should().BeFalse(); result.TextSource.Should().BeOfType <TextSource>() .Which.Text.Should().Be(expected); }
public void TwoVariables() { var text = "{MC} empurrou {antagonist} da ponte."; var sut = new TextSourceParser(); var result = sut.Parse(text); result.IsError.Should().BeFalse(); result.TextSource.Should().BeOfType <TextSource>() .Which.Interpolator.Should().BeOfType <Interpolator>() .Which.Values.Should().BeEquivalentTo(new[] { new { IsVariable = true, Value = "MC" }, new { IsVariable = false, Value = " empurrou " }, new { IsVariable = true, Value = "antagonist" }, new { IsVariable = false, Value = " da ponte." } }); }