本文整理汇总了C#中Microsoft.Azure.Commands.Batch.Test.ScenarioTests.ScenarioTestContext类的典型用法代码示例。如果您正苦于以下问题:C# ScenarioTestContext类的具体用法?C# ScenarioTestContext怎么用?C# ScenarioTestContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ScenarioTestContext类属于Microsoft.Azure.Commands.Batch.Test.ScenarioTests命名空间,在下文中一共展示了ScenarioTestContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestCancelCertificateDelete
public void TestCancelCertificateDelete()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
string thumbprint = null;
string poolId = "certPool";
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-TestCancelCertificateDelete '{0}' '{1}'", BatchTestHelpers.TestCertificateAlgorithm, thumbprint) }; },
() =>
{
context = new ScenarioTestContext();
thumbprint = ScenarioTestHelpers.AddTestCertificate(controller, context, BatchTestHelpers.TestCertificateFileName);
CertificateReference certRef = new CertificateReference();
certRef.StoreLocation = CertStoreLocation.CurrentUser;
certRef.StoreName = "My";
certRef.ThumbprintAlgorithm = BatchTestHelpers.TestCertificateAlgorithm;
certRef.Thumbprint = thumbprint;
certRef.Visibility = CertificateVisibility.Task;
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, 0, certRef);
ScenarioTestHelpers.DeleteTestCertificate(controller, context, BatchTestHelpers.TestCertificateAlgorithm, thumbprint);
ScenarioTestHelpers.WaitForCertificateToFailDeletion(controller, context, BatchTestHelpers.TestCertificateAlgorithm, thumbprint);
},
() =>
{
ScenarioTestHelpers.DeletePool(controller, context, poolId);
ScenarioTestHelpers.DeleteTestCertificate(controller, context, BatchTestHelpers.TestCertificateAlgorithm, thumbprint);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例2: TestListJobSchedulesByFilter
public void TestListJobSchedulesByFilter()
{
BatchController controller = BatchController.NewInstance;
string jobScheduleId1 = "testId1";
string jobScheduleId2 = "testId2";
string jobScheduleId3 = "thirdtestId";
string jobSchedulePrefix = "testId";
int matches = 2;
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-ListJobSchedulesByFilter '{0}' '{1}'", jobSchedulePrefix, matches) }; },
() =>
{
context = new ScenarioTestContext();
ScenarioTestHelpers.CreateTestJobSchedule(controller, context, jobScheduleId1, null);
ScenarioTestHelpers.CreateTestJobSchedule(controller, context, jobScheduleId2, null);
ScenarioTestHelpers.CreateTestJobSchedule(controller, context, jobScheduleId3, null);
},
() =>
{
ScenarioTestHelpers.DeleteJobSchedule(controller, context, jobScheduleId1);
ScenarioTestHelpers.DeleteJobSchedule(controller, context, jobScheduleId2);
ScenarioTestHelpers.DeleteJobSchedule(controller, context, jobScheduleId3);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例3: TestListCertificatesByFilter
public void TestListCertificatesByFilter()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
string state = "active";
string thumbprint1 = null;
string toDeleteThumbprint = null;
int matchCount = 1;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-ListCertificatesByFilter '{0}' '{1}' '{2}'", state, toDeleteThumbprint, matchCount) }; },
() =>
{
context = new ScenarioTestContext();
thumbprint1 = ScenarioTestHelpers.AddTestCertificate(controller, context, BatchTestHelpers.TestCertificateFileName1);
toDeleteThumbprint = ScenarioTestHelpers.AddTestCertificate(controller, context, BatchTestHelpers.TestCertificateFileName2);
},
() =>
{
ScenarioTestHelpers.DeleteTestCertificate(controller, context, BatchTestHelpers.TestCertificateAlgorithm, thumbprint1);
// Other cert is deleted as the first part of the PowerShell test script, but we ensure it's gone.
try
{
ScenarioTestHelpers.DeleteTestCertificate(controller, context, BatchTestHelpers.TestCertificateAlgorithm, toDeleteThumbprint);
}
catch { }
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例4: TestUpdateApplicationPackage
public void TestUpdateApplicationPackage()
{
string id = "updateApplicationPackage";
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() =>
{
return new string[]
{
string.Format(string.Format("Test-UpdateApplicationPackage '{0}' '{1}' '{2}'", id, version, filePath))
};
},
() =>
{
context = new ScenarioTestContext();
ScenarioTestHelpers.CreateApplicationPackage(controller, context, id, version, filePath);
},
() =>
{
ScenarioTestHelpers.DeleteApplicationPackage(controller, context, id, version);
ScenarioTestHelpers.DeleteApplication(controller, context, id);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例5: TestListPoolsByFilter
public void TestListPoolsByFilter()
{
BatchController controller = BatchController.NewInstance;
string poolId1 = "testFilter1";
string poolId2 = "testFilter2";
string poolId3 = "thirdFilterTest";
string poolPrefix = "testFilter";
int matches = 2;
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-ListPoolsByFilter '{0}' '{1}'", poolPrefix, matches) }; },
() =>
{
context = new ScenarioTestContext();
ScenarioTestHelpers.CreateTestPool(controller, context, poolId1, 0);
ScenarioTestHelpers.CreateTestPool(controller, context, poolId2, 0);
ScenarioTestHelpers.CreateTestPool(controller, context, poolId3, 0);
},
() =>
{
ScenarioTestHelpers.DeletePool(controller, context, poolId1);
ScenarioTestHelpers.DeletePool(controller, context, poolId2);
ScenarioTestHelpers.DeletePool(controller, context, poolId3);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例6: GetBatchAccountContextWithKeys
/// <summary>
/// Get Batch Context with keys
/// </summary>
public static BatchAccountContext GetBatchAccountContextWithKeys(BatchController controller, string accountName)
{
BatchClient client = new BatchClient(controller.BatchManagementClient, controller.ResourceManagementClient);
BatchAccountContext context = client.ListKeys(null, accountName);
ScenarioTestContext testContext = new ScenarioTestContext(context);
return testContext;
}
示例7: TestGetAndListComputeNodesWithSelect
public void TestGetAndListComputeNodesWithSelect()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
string computeNodeId = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-GetAndListComputeNodesWithSelect '{0}' '{1}'", poolId, computeNodeId) }; },
() =>
{
context = new ScenarioTestContext();
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
},
null,
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例8: TestListComputeNodesByFilter
public void TestListComputeNodesByFilter()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
string state = "idle";
int matches = 0;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-ListComputeNodesByFilter '{0}' '{1}' '{2}'", poolId, state, matches) }; },
() =>
{
context = new ScenarioTestContext();
matches = ScenarioTestHelpers.GetPoolCurrentDedicated(controller, context, poolId);
},
null,
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例9: TestCreateComputeNodeUserPipeline
public void TestCreateComputeNodeUserPipeline()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
string computeNodeId = null;
string userName = "createuser2";
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-CreateComputeNodeUser '{0}' '{1}' '{2}' 1", poolId, computeNodeId, userName) }; },
() =>
{
context = new ScenarioTestContext();
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, poolId);
},
null,
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例10: TestGetPoolById
public void TestGetPoolById()
{
BatchController controller = BatchController.NewInstance;
string poolId = "testGetPool";
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-GetPoolById '{0}'", poolId) }; },
() =>
{
context = new ScenarioTestContext();
ScenarioTestHelpers.CreateTestPool(controller, context, poolId, 0);
},
() =>
{
ScenarioTestHelpers.DeletePool(controller, context, poolId);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例11: TestGetCertificateByThumbprint
public void TestGetCertificateByThumbprint()
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
string thumbprint = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-GetCertificateByThumbprint '{0}' '{1}'", BatchTestHelpers.TestCertificateAlgorithm, thumbprint) }; },
() =>
{
context = new ScenarioTestContext();
thumbprint = ScenarioTestHelpers.AddTestCertificate(controller, context, BatchTestHelpers.TestCertificateFileName1);
},
() =>
{
ScenarioTestHelpers.DeleteTestCertificate(controller, context, BatchTestHelpers.TestCertificateAlgorithm, thumbprint);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例12: TestCreateTaskCollection
public void TestCreateTaskCollection()
{
BatchController controller = BatchController.NewInstance;
string jobId = "createTaskCollectionJob";
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-CreateTaskCollection '{0}'", jobId) }; },
() =>
{
context = new ScenarioTestContext();
ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
},
() =>
{
ScenarioTestHelpers.DeleteJob(controller, context, jobId);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例13: TestGetNodeFileByTaskByName
public void TestGetNodeFileByTaskByName()
{
BatchController controller = BatchController.NewInstance;
string jobId = "testGetNodeFileByTaskJob";
string taskId = "testTask";
string nodeFileName = "stdout.txt";
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-GetNodeFileByTaskByName '{0}' '{1}' '{2}'", jobId, taskId, nodeFileName) }; },
() =>
{
context = new ScenarioTestContext();
ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId);
ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
},
() =>
{
ScenarioTestHelpers.DeleteJob(controller, context, jobId);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例14: TestListNodeFilesByTaskByFilter
public void TestListNodeFilesByTaskByFilter()
{
BatchController controller = BatchController.NewInstance;
string jobId = "listNodeFileByTaskFilterJob";
string taskId = "testTask";
string nodeFilePrefix = "std";
int matches = 2;
BatchAccountContext context = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-ListNodeFilesByTaskByFilter '{0}' '{1}' '{2}' '{3}'", jobId, taskId, nodeFilePrefix, matches) }; },
() =>
{
context = new ScenarioTestContext();
ScenarioTestHelpers.CreateTestJob(controller, context, jobId);
ScenarioTestHelpers.CreateTestTask(controller, context, jobId, taskId);
ScenarioTestHelpers.WaitForTaskCompletion(controller, context, jobId, taskId);
},
() =>
{
ScenarioTestHelpers.DeleteJob(controller, context, jobId);
},
TestUtilities.GetCallingClass(),
TestUtilities.GetCurrentMethodName());
}
示例15: TestGetComputeNodeRemoteLoginSettings
private void TestGetComputeNodeRemoteLoginSettings(bool usePipeline, string testMethodName)
{
BatchController controller = BatchController.NewInstance;
BatchAccountContext context = null;
string computeNodeId = null;
controller.RunPsTestWorkflow(
() => { return new string[] { string.Format("Test-GetRemoteLoginSettings '{0}' '{1}' '{2}'", iaasPoolId, computeNodeId, usePipeline ? 1 : 0) }; },
() =>
{
context = new ScenarioTestContext();
computeNodeId = ScenarioTestHelpers.GetComputeNodeId(controller, context, iaasPoolId);
},
null,
TestUtilities.GetCallingClass(),
testMethodName);
}