Exemple #1
0
        public void ReadStringTest()
        {
            const string value = "There is no spoon!";

            byte[] data;
            using (var ms = new MemoryStream()) {
                using (var writer = new BinaryWriter(ms, Encoding.UTF8, true)) {
                    writer.WriteNullTerminatedString(value);
                }
                data = ms.ToArray();
            }
            When(slotSource[kSlotIndex]).ThenReturn(data);
            AssertEquals(value, testObj.ReadString(kSlotIndex));
        }
Exemple #2
0
        public void TestReadString()
        {
            const string value = "There is no spoon!";

            byte[] data;
            using (var ms = new MemoryStream()) {
                using (var writer = new BinaryWriter(ms)) {
                    writer.WriteNullTerminatedString(value);
                }
                data = ms.ToArray();
            }
            when(() => slotSource[SLOT_INDEX]).ThenReturn(data);
            assertEquals(value, testObj.ReadString(SLOT_INDEX));
        }