Example #1
0
        public void シリアライズのテスト()
        {
            var factory = new CdrSerializerFactory();

            var serializer = factory.GetSerializer<TimedLong>(true);

            TimedLong data = new TimedLong(new Time(0x12, 0x34), 0x5678);

            var stream = new MemoryStream();
            serializer.Serialize(data, stream);

            stream.Length.Is(12);
            stream.ToArray().Is(new List<byte> {
                0x12, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x78, 0x56, 0x00, 0x00 });
        }
Example #2
0
        public void デシリアライズのテスト()
        {
            var factory = new CdrSerializerFactory();

            var serializer = factory.GetSerializer<TimedLong>(true);

            var stream = new MemoryStream(new byte[] {
                0x12, 0x00, 0x00, 0x00, 0x34, 0x00, 0x00, 0x00, 0x78, 0x56, 0x00, 0x00 });
            TimedLong data = serializer.Deserialize(stream);

            data.tm.sec.Is(0x12);
            data.tm.nsec.Is(0x34);
            data.data.Is(0x5678);

            //ObjectDumper.Write(data);
        }
Example #3
0
        public void データを書き込んでみる()
        {
            var recorder = new Recorder("127.0.0.1:2809/SampleOut0.rtc", "SampleOut0.out");

            recorder.IsAlive.Is(true);

            recorder.Play();

            recorder.IsAlive.Is(true);

            var comp = NamingServiceManager.Default.GetComponent("127.0.0.1:2809/SampleOut0.rtc");
            var port = comp.GetPort("SampleOut0.out") as OutPortServiceMock;

            port.IsNotNull();

            var inportcdr = port.GetInPortCdr();

            inportcdr.IsNotNull();

            var factory    = new CdrSerializerFactory();
            var serializer = factory.GetSerializer <TimedLong>();

            for (int i = 0; i < 100; i++)
            {
                var stream = new MemoryStream();
                var data   = new TimedLong(new Time(0x12, 0x34), i);
                serializer.Serialize(data, stream);

                inportcdr.put(stream.ToArray());
            }

            recorder.IsAlive.Is(true);

            recorder.Stop();

            recorder.IsAlive.Is(true);

            recorder.RecordDescription.Count.Is(100);
            recorder.RecordDescription.SumSize.Is(1200);

            Directory.EnumerateFiles(TestDataDirectory).Count().Is(2);
        }
Example #4
0
        public void データを書き込んでみる()
        {
            var recorder = new Recorder("127.0.0.1:2809/SampleOut0.rtc", "SampleOut0.out");

            recorder.IsAlive.Is(true);

            recorder.Play();

            recorder.IsAlive.Is(true);

            var comp = NamingServiceManager.Default.GetComponent("127.0.0.1:2809/SampleOut0.rtc");
            var port = comp.GetPort("SampleOut0.out") as OutPortServiceMock;

            port.IsNotNull();

            var inportcdr = port.GetInPortCdr();

            inportcdr.IsNotNull();

            var factory = new CdrSerializerFactory();
            var serializer = factory.GetSerializer<TimedLong>();

            for (int i = 0; i < 100; i++)
            {
                var stream = new MemoryStream();
                var data = new TimedLong(new Time(0x12, 0x34), i);
                serializer.Serialize(data, stream);

                inportcdr.put(stream.ToArray());
            }

            recorder.IsAlive.Is(true);

            recorder.Stop();

            recorder.IsAlive.Is(true);

            recorder.RecordDescription.Count.Is(100);
            recorder.RecordDescription.SumSize.Is(1200);

            Directory.EnumerateFiles(TestDataDirectory).Count().Is(2);
        }