本文整理汇总了C#中MetaModel.GetOperation方法的典型用法代码示例。如果您正苦于以下问题:C# MetaModel.GetOperation方法的具体用法?C# MetaModel.GetOperation怎么用?C# MetaModel.GetOperation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaModel
的用法示例。
在下文中一共展示了MetaModel.GetOperation方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ReOpenAnAssetTest
public void ReOpenAnAssetTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
// create a new story
var projectId = Oid.FromToken("Scope:0", metaModel);
var assetType = metaModel.GetAssetType("Story");
var story = services.New(assetType, projectId);
var nameAttribute = assetType.GetAttributeDefinition("Name");
story.SetAttributeValue(nameAttribute, "My New Story");
services.Save(story);
// closes the story
var closeOperation = metaModel.GetOperation("Story.Inactivate");
var closeId = services.ExecuteOperation(closeOperation, story.Oid);
//reopens the story
var activateOperation = metaModel.GetOperation("Story.Reactivate");
var activeId = services.ExecuteOperation(activateOperation, story.Oid);
var query = new Query(activeId.Momentless);
var assetState = metaModel.GetAttributeDefinition("Story.AssetState");
query.Selection.Add(assetState);
var result = services.Retrieve(query);
Asset activeStory = result.Assets[0];
Assert.AreEqual("Active", activeStory.GetAttribute(assetState).Value.ToString());
}
示例2: DeleteAnAssetTest
public void DeleteAnAssetTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
// create a new story so we can delete it
var projectId = Oid.FromToken("Scope:0", metaModel);
var assetType = metaModel.GetAssetType("Story");
var newStory = services.New(assetType, projectId);
var nameAttribute = assetType.GetAttributeDefinition("Name");
newStory.SetAttributeValue(nameAttribute, "My New Story");
services.Save(newStory);
// delete the story
var deleteOperation = metaModel.GetOperation("Story.Delete");
var deletedId = services.ExecuteOperation(deleteOperation, newStory.Oid);
var query = new Query(deletedId.Momentless);
QueryResult result = services.Retrieve(query);
Assert.AreEqual(0, result.TotalAvaliable);
// The delete operation returns the Oid with the new Moment of the deleted asset.
// Future queries will automatically exclude deleted assets from results.
// Currently there is no support for undeleting a deleted asset.
}