示例#1
0
        public void GetHashCodeMethod()
        {
            var view1 = new Yogi.MsgpackView(new byte[] { 11 });
            var view2 = new Yogi.MsgpackView(new byte[] { 55 });

            Assert.NotEqual(view1.GetHashCode(), view2.GetHashCode());
        }
示例#2
0
        public void FromMsgpackView()
        {
            var msgpack_view = new Yogi.MsgpackView(new byte[] { 1, 2, 3 });

            var view = new Yogi.PayloadView(msgpack_view);

            Assert.Equal(view.Data, msgpack_view.Data);
            Assert.Equal(view.Size, msgpack_view.Size);
            Assert.Equal(Yogi.EncodingType.Msgpack, view.Encoding);
        }
示例#3
0
        public void FromBuffer()
        {
            var data = new byte[] { 1, 2, 3 };

            var view = new Yogi.MsgpackView(data);

            Assert.Equal(view.Data, data);
            Assert.Equal(view.Size, data.Length);

            view = data;
            Assert.Equal(view.Data, data);
            Assert.Equal(view.Size, data.Length);
        }
示例#4
0
        public void Comparison()
        {
            var view1 = new Yogi.MsgpackView(new byte[] { 11 });
            var view2 = new Yogi.MsgpackView(new byte[] { 11 });
            var view3 = new Yogi.MsgpackView(new byte[] { 55 });

            Assert.True(view1 == view2);
            Assert.False(view1 == view3);

            Assert.False(view1 != view2);
            Assert.True(view1 != view3);

            Assert.False(view1.Equals(new Exception()));
            Assert.False(view1.Equals(null));
            Assert.True(view1.Equals(view2));
            Assert.False(view1.Equals(view3));
        }