public void LockRequest() { const string uri = "a.txt"; const string token = "aaaa"; const string user = "******"; var info = new LockInfo(uri, LockType.Write, LockScope.Exclusive, 0, user, token); var res = PropFindHelper.GetLockDiscovery(info); var pos = res.IndexOf("<d:href>" + token + "</d:href>", StringComparison.Ordinal); Assert.IsTrue(pos > 0); pos = res.IndexOf("<d:depth>" + 0 + "</d:depth>", StringComparison.Ordinal); Assert.IsTrue(pos > 0); pos = res.IndexOf("<d:href>" + user + "</d:href>", StringComparison.Ordinal); Assert.IsTrue(pos > 0); }
internal override Response GetResponse() { var response = new Response(_code); var lockInfo = LockManager.GetInstanse().GetLockInfo(_mFileName); if (null == lockInfo) { return(response); } var xmlContent = PropFindHelper.GetLockDiscovery(lockInfo); Logger.Trace("RESPONSE " + xmlContent); Stream stream = new MemoryStream(Encoding.UTF8.GetBytes(xmlContent)); response.SetContentLength(stream.Length); response.SetData(stream); return(response); }