Пример #1
0
        public void WriteThrowsIfWouldGoOutOfBounds()
        {
            var mem = new MirroredMemory(10, new FixedMemory(10));
            var buf = new byte[5];

            Assert.Throws <IndexOutOfRangeException>(() => mem.Write(9, buf));
        }
Пример #2
0
        public void WriteThrowsIfOffsetIsNegative()
        {
            var mem = new MirroredMemory(10, new FixedMemory(10));
            var buf = new byte[5];
            var ex  = Assert.Throws <ArgumentOutOfRangeException>(() => mem.Write(-1, buf));

            Assert.Equal("offset", ex.ParamName);
        }
Пример #3
0
        public void WriteMirrorsAsManyTimesAsNecessaryToFillWrite()
        {
            var ram = new FixedMemory(5);
            var mem = new MirroredMemory(20, ram);
            var buf = CreateData(15);

            mem.Write(3, buf.Span);

            Assert.Equal(
                new byte[] { 13, 14, 15, 11, 12 },
                ram.Data.ToArray());
        }