예제 #1
0
        public void Send <T>(int csId, T value)
        {
            if (csId < 0)
            {
                throw new Exception("Negative ids are reserved for SocketFlow");
            }
            var wrapper = flowBinder.GetWrapper <T>();

            protocol.Send(csId, wrapper.DataWrapper.FormatObject(value));
        }
예제 #2
0
        public void GetWrapper_OneWrapper_ShouldBeReturnCorrectWrapper()
        {
            Action <Planet> action  = Console.WriteLine;
            var             wrapper = new JsonDataWrapper <Planet>();

            binder.Using(wrapper);
            binder.Bind <Planet>(1, action);

            var actualWrapperInfo = binder.GetWrapper(1);

            Assert.AreEqual(typeof(Planet), actualWrapperInfo.Type);
            Assert.AreEqual(wrapper, actualWrapperInfo.DataWrapper);
        }
예제 #3
0
        internal byte[] GetData <T>(T value)
        {
            var wrapper = flowBinder.GetWrapper <T>();

            return(wrapper.DataWrapper.FormatObject(value));
        }