Exemplo n.º 1
0
        public void MakeProtocolErrorFrame_WithDetails_MakesAFrame()
        {
            var frame = EpoxyConnection.MakeProtocolErrorFrame(MeaninglessErrorCode, AnyDetails, LoggerTests.BlackHole);
            Assert.NotNull(frame);
            Assert.AreEqual(1, frame.Framelets.Count);
            Assert.AreEqual(FrameletType.ProtocolError, frame.Framelets[0].Type);

            var inputBuffer = new Bond.IO.Unsafe.InputBuffer(frame.Framelets[0].Contents);
            var fastBinaryReader = new FastBinaryReader<InputBuffer>(inputBuffer, version: 1);
            var error = Deserialize<ProtocolError>.From(fastBinaryReader);
            Assert.AreEqual(MeaninglessErrorCode, error.error_code);
            Assert.NotNull(error.details);
            var details = error.details.Deserialize();
            Assert.IsTrue(AnyDetails.IsEqual<Error, Error>(details));
        }
        public void MakeProtocolErrorFrame_WithDetails_MakesAFrame()
        {
            var frame = EpoxyConnection.MakeProtocolErrorFrame(MeaninglessErrorCode, AnyDetails, LoggerTests.BlackHole);

            Assert.NotNull(frame);
            Assert.AreEqual(1, frame.Framelets.Count);
            Assert.AreEqual(FrameletType.ProtocolError, frame.Framelets[0].Type);

            var inputBuffer      = new Bond.IO.Unsafe.InputBuffer(frame.Framelets[0].Contents);
            var fastBinaryReader = new FastBinaryReader <InputBuffer>(inputBuffer, version: 1);
            var error            = Deserialize <ProtocolError> .From(fastBinaryReader);

            Assert.AreEqual(MeaninglessErrorCode, error.error_code);
            Assert.NotNull(error.details);
            var details = error.details.Deserialize();

            Assert.IsTrue(AnyDetails.IsEqual <Error, Error>(details));
        }