本文整理汇总了C#中Smb2FunctionalClient.ChangeNotify方法的典型用法代码示例。如果您正苦于以下问题:C# Smb2FunctionalClient.ChangeNotify方法的具体用法?C# Smb2FunctionalClient.ChangeNotify怎么用?C# Smb2FunctionalClient.ChangeNotify使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Smb2FunctionalClient
的用法示例。
在下文中一共展示了Smb2FunctionalClient.ChangeNotify方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: BVT_SMB2Basic_CancelRegisteredChangeNotify
public void BVT_SMB2Basic_CancelRegisteredChangeNotify()
{
uint status;
string testDirectory = CreateTestDirectory(TestConfig.SutComputerName, TestConfig.BasicFileShare);
BaseTestSite.Log.Add(
LogEntryKind.Debug,
"Test directory \"{0}\" was created on share \"{1}\"", testDirectory, TestConfig.BasicFileShare);
client1 = new Smb2FunctionalClient(TestConfig.Timeout, TestConfig, BaseTestSite);
client1.Smb2Client.ChangeNotifyResponseReceived += new Action<FILE_NOTIFY_INFORMATION[],Packet_Header,CHANGE_NOTIFY_Response>(OnChangeNotifyResponseReceived);
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Start a client to create a file by sending the following requests: NEGOTIATE; SESSION_SETUP; TREE_CONNECT; CREATE");
client1.ConnectToServer(TestConfig.UnderlyingTransport, TestConfig.SutComputerName, TestConfig.SutIPAddress);
status = client1.Negotiate(TestConfig.RequestDialects, TestConfig.IsSMB1NegotiateEnabled);
status = client1.SessionSetup(
TestConfig.DefaultSecurityPackage,
TestConfig.SutComputerName,
TestConfig.AccountCredential,
TestConfig.UseServerGssToken);
uint treeId1;
status = client1.TreeConnect(uncSharePath, out treeId1);
Smb2CreateContextResponse[] serverCreateContexts;
FILEID fileId1;
status = client1.Create(
treeId1,
testDirectory,
CreateOptions_Values.FILE_DIRECTORY_FILE,
out fileId1,
out serverCreateContexts);
BaseTestSite.Log.Add(
LogEntryKind.Comment,
"Client starts to register CHANGE_NOTIFY on directory \"{0}\"", testDirectory);
client1.ChangeNotify(treeId1, fileId1, CompletionFilter_Values.FILE_NOTIFY_CHANGE_LAST_ACCESS);
BaseTestSite.Log.Add(
LogEntryKind.Comment,
"Client starts to cancel the registered CHANGE_NOTIFY on directory \"{0}\"", testDirectory);
client1.Cancel();
BaseTestSite.Assert.IsTrue(
changeNotificationReceived.WaitOne(TestConfig.WaitTimeoutInMilliseconds),
"Change notification should be received within {0} milliseconds", TestConfig.WaitTimeoutInMilliseconds);
BaseTestSite.Assert.AreNotEqual(
Smb2Status.STATUS_SUCCESS,
receivedChangeNotifyHeader.Status, "CHANGE_NOTIFY is not expected to success after cancel, actually server returns {0}.",
Smb2Status.GetStatusCode(receivedChangeNotifyHeader.Status));
BaseTestSite.CaptureRequirementIfAreEqual(
Smb2Status.STATUS_CANCELLED,
receivedChangeNotifyHeader.Status,
RequirementCategory.STATUS_CANCELLED.Id,
RequirementCategory.STATUS_CANCELLED.Description);
BaseTestSite.Log.Add(LogEntryKind.TestStep, "Tear down the client by sending the following requests: CLOSE; TREE_DISCONNECT; LOG_OFF");
client1.Close(treeId1, fileId1);
client1.TreeDisconnect(treeId1);
client1.LogOff();
}