Example #1
0
        public void DeleteRequestTest()
        {
            Status status  = Status.UnknownCommand;
            var    request = new DeleteRequest
            {
                Key       = "Hello".Select(c => (byte)c).ToArray(),
                RequestId = 0,
                CallBack  = (s) => status = s,
            };

            var queryBuffer = request.GetQueryBuffer();

            Assert.IsNotNull(queryBuffer);
            CollectionAssert.AreEqual(DELETE_QUERY, queryBuffer, "The delete query buffer is different of the expected one");

            var header = new MemcacheResponseHeader {
                Opcode = Opcode.Delete, Status = Status.NoError
            };

            Assert.DoesNotThrow(() => request.HandleResponse(header, null, null, null));
            Assert.AreEqual(Status.NoError, status);
        }