Пример #1
0
        private void ReadData(Stream stream)
        {
            ResetMetaDefinitions();
            using var reader = new DefaultBinaryReader(stream, this, new DefaultCommandFactory());
            reader.ReadCommands();

            _messages.AddRange(reader.Messages);
        }
Пример #2
0
        private void Test(Action <IBinaryWriter> writerAction, Action <IBinaryReader> readerAction)
        {
            _stream.SetLength(0);
            var command = new TestCommand(writerAction, readerAction);

            _writer.WriteCommand(command);
            _stream.Position = 0;

            _commandFactory.Setup(c => c.CreateCommand(It.IsAny <int>(), It.IsAny <int>(), It.IsAny <CgmFile>())).Returns(command);

            _reader.ReadCommands();
            if (_reader.Messages.Any())
            {
                Assert.Fail(string.Join("\r\n", _reader.Messages.Select(m => m.ToString()).ToArray()));
            }
        }