Esempio n. 1
0
            public byte[] StoreAndGet(Network network)
            {
                // Make sure any serialized Network is first halted.
                network.PreSerialize();

                byte[] bytes = defaultSerializer.Serialize(network);

                try
                {
                    WriteFile(serialConfig, bytes);
                }
                catch (IOException e)
                {
                    LOGGER.Error($"IOException in writing network: {e}");
                    throw;
                }

                return(bytes);
            }
Esempio n. 2
0
        public void TestSerializeDeSerialize()
        {
            SerializerCore serializer = Persistence.Get().Serializer();

            IInference inf = new ManualInputWithPostDeserialize();

            byte[] bytes = serializer.Serialize(inf);
            Assert.IsNotNull(bytes);

            IInference serializedInf = serializer.Deserialize <ManualInput>(bytes);

            Assert.IsNotNull(serializedInf);

            Assert.IsTrue(callVerify.Count == 1);
        }