Пример #1
0
        public void DeleteRequestFailTest()
        {
            Status status = Status.UnknownCommand;
            var request = new DeleteRequest
            {
                Key = "Hello".Select(c => (byte)c).ToArray(),
                RequestId = 0,
                CallBack = (s) => status = s,
            };

            Assert.DoesNotThrow(request.Fail);
            Assert.AreEqual(Status.InternalError, status, "The status sent by a fail should be InternalError");
        }
Пример #2
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);
        }