public void TestStringEncoderEmptyString() { const int n = 10; var encoder = new StringEncoder(); for (int i = 0; i < n; i++) { encoder.Write(string.Empty); } var data = encoder.ToArray(); using var stream = new MemoryStream(data); var decoder = new StringDecoder(stream); for (int i = 0; i < n; i++) { Assert.AreEqual(string.Empty, decoder.Read()); } }
public void TestStringEncoder() { const int n = 100; var words = new List <string>(n); var encoder = new StringEncoder(); for (int i = 0; i < n; i++) { var v = Guid.NewGuid().ToString(); words.Add(v); encoder.Write(v); } var data = encoder.ToArray(); using var stream = new MemoryStream(data); var decoder = new StringDecoder(stream); for (int i = 0; i < words.Count; i++) { Assert.AreEqual(words[i], decoder.Read()); } }
public void WriteString(string s) { _stringEncoder.Write(s); }