public void CanReadAndWritePrimitives() { const string test = "tacos"; const float a = float.MinValue; const int b = int.MaxValue; const ulong c = ulong.MaxValue; const double d = double.NegativeInfinity; using (var str = new MemoryStream()) using (var writer = new WriterStream(str)) { writer.WriteString(Encoding.UTF8, test, test.Length); writer.WriteFloat(a); writer.WriteUInt32(b); writer.WriteUInt64(c); writer.WriteDouble(d); writer.WriteVarUInt32(b); writer.WriteVarUInt64(c); str.Position = 0; using (var reader = new ReaderStream(str)) { Assert.AreEqual(reader.ReadString(Encoding.UTF8, test.Length), test); Assert.AreEqual(reader.ReadFloat(), a); Assert.AreEqual(reader.ReadUInt32(), b); Assert.AreEqual(reader.ReadUInt64(), c); Assert.AreEqual(reader.ReadDouble(), d); Assert.AreEqual(reader.ReadVarUInt32(), b); Assert.AreEqual(reader.ReadVarUInt64(), c); } } }