-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(resp): ajoute un test pour le décodage de strings
- Loading branch information
1 parent
de0a444
commit 0a4a7ee
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
using System.Text; | ||
using Shared.Resp; | ||
|
||
namespace Shared.unitTests; | ||
|
||
public class RespTests | ||
{ | ||
[Theory] | ||
[InlineData("+OK\r\n", "OK")] | ||
[InlineData("-NOT OK\r\n", "NOT OK")] | ||
[InlineData("$5\r\nHELLO\r\n", "HELLO")] | ||
[InlineData("$6\r\n\nWORLD\r\n", "\nWORLD")] | ||
[InlineData("$0\r\n\r\n", "")] | ||
public void StringDecode(string input, string expected) | ||
{ | ||
using var stream = new MemoryStream(Encoding.UTF8.GetBytes(input)); | ||
using var reader = new StreamReader(stream); | ||
|
||
var result = Item.Decode(reader); | ||
|
||
Assert.Equal(expected, result.ToString()); | ||
} | ||
} |