public void TokensShouldReturnFormattedWhenErrorIsTrue() { //Arrange var tokenService = new Service.TokenService.TokenService(); var tokensResult = new List <TokenResult> { new TokenResult(false, "", null), new TokenResult(false, "", null), new TokenResult(false, "", null) }; //Act var tokenFormatted = tokenService.FormatTokenString(tokensResult).ToList(); //Assert foreach (var item in tokensResult.Select((value, index) => new { value, index })) { Assert.Equal(tokenFormatted[item.index], item.value.Message); } }
public void TokensShouldReturnFormattedWhenErrorIsFalse() { //Arrange var tokenService = new Service.TokenService.TokenService(); var tokensResult = new List <TokenResult> { new TokenResult(true, "var", new Token(Tag.ID, "var", 6, 2)), new TokenResult(true, "public", new Token(Tag.KW, "public", 1, 2)), new TokenResult(true, "while", new Token(Tag.KW, "while", 3, 4)) }; //Act var tokenFormatted = tokenService.FormatTokenString(tokensResult).ToList(); //Assert foreach (var item in tokensResult.Select((value, index) => new { value, index })) { Assert.Equal(tokenFormatted[item.index], string.Concat("Token: <", item.value.Token.Tag.ToString(), ":'", item.value.Token.Lexeme, "'> ", "Linha: ", item.value.Token.Line, " Coluna: ", item.value.Token.Column)); } }