本文整理汇总了C#中MetaModel.GetAssetType方法的典型用法代码示例。如果您正苦于以下问题:C# MetaModel.GetAssetType方法的具体用法?C# MetaModel.GetAssetType怎么用?C# MetaModel.GetAssetType使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MetaModel
的用法示例。
在下文中一共展示了MetaModel.GetAssetType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TestFixtureSetUp
public void TestFixtureSetUp()
{
V1APIConnector dataConnector = new V1APIConnector(v1Url + dataPath, username, password);
V1APIConnector metaConnector = new V1APIConnector(v1Url + metaPath);
V1APIConnector localConnector = new V1APIConnector(v1Url + localizationPath);
localizer = new Localizer(localConnector);
metaModel = new MetaModel(metaConnector);
services = new Services(metaModel, dataConnector);
timeboxType = metaModel.GetAssetType("Timebox");
timeboxName = timeboxType.GetAttributeDefinition("Name");
timeboxID = timeboxType.GetAttributeDefinition("ID");
}
示例2: QueryProjects
public void QueryProjects() {
var proxyProvider = new ProxyProvider(new Uri(ProxyPath), ProxyUsername, ProxyPassword);
IAPIConnector metaConnector = new V1APIConnector(V1Path + "meta.v1/", V1Username, V1Password, false, proxyProvider);
IMetaModel metaModel = new MetaModel(metaConnector);
IAPIConnector dataConnector = new V1APIConnector(V1Path + "rest-1.v1/", V1Username, V1Password, false, proxyProvider);
IServices services = new Services(metaModel, dataConnector);
var projectType = metaModel.GetAssetType("Scope");
var scopeQuery = new Query(projectType);
var result = services.Retrieve(scopeQuery);
Assert.IsTrue(result.Assets.Count > 0);
}
示例3: GetMultipleAssetsTest
public void GetMultipleAssetsTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
var assetType = metaModel.GetAssetType("Story");
var query = new Query(assetType);
var nameAttribute = assetType.GetAttributeDefinition("Name");
var estimateAttribute = assetType.GetAttributeDefinition("Estimate");
query.Selection.Add(nameAttribute);
query.Selection.Add(estimateAttribute);
var result = services.Retrieve(query);
Assert.Greater(result.Assets.Count, 1);
}
示例4: 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());
}
示例5: 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.
}
示例6: AddNewAssetTest
public void AddNewAssetTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
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);
Assert.False(newStory.Oid.IsNull);
}
示例7: UpdateMultiValueRelationTest
public void UpdateMultiValueRelationTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
var storyId = Oid.FromToken("Story:1124", metaModel);
var query = new Query(storyId);
var storyType = metaModel.GetAssetType("Story");
var ownersAttribute = storyType.GetAttributeDefinition("Owners");
query.Selection.Add(ownersAttribute);
var result = services.Retrieve(query);
var story = result.Assets[0];
var values = story.GetAttribute(ownersAttribute).Values;
var owners = values.Cast<object>().ToList();
if (owners.Count >= 1) story.RemoveAttributeValue(ownersAttribute, owners[0]);
services.Save(story);
}
示例8: UpdateSingleValueRelationTest
public void UpdateSingleValueRelationTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
var storyId = Oid.FromToken("Story:1094", metaModel);
var query = new Query(storyId);
var storyType = metaModel.GetAssetType("Story");
var sourceAttribute = storyType.GetAttributeDefinition("Source");
query.Selection.Add(sourceAttribute);
var result = services.Retrieve(query);
var story = result.Assets[0];
var oldSource = story.GetAttribute(sourceAttribute).Value.ToString();
story.SetAttributeValue(sourceAttribute, GetNextSourceId(oldSource));
services.Save(story);
}
示例9: QueryTrackedEpicsForMultipleProjectsUsingVariables
public void QueryTrackedEpicsForMultipleProjectsUsingVariables() {
var metaConnector = new V1APIConnector(VersionOneUrl + "meta.v1/", "admin", "admin");
var metaModel = new MetaModel(metaConnector);
var scopeVariable = new QueryVariable("Scope", "Scope:2176");
var epicType = metaModel.GetAssetType("Epic");
var query = new Query(epicType);
var notClosedEpicAttribute = epicType.GetAttributeDefinition("AssetState");
var notClosedEpicTerm = new FilterTerm(notClosedEpicAttribute);
notClosedEpicTerm.NotEqual("Closed");
var scopeAttribute = epicType.GetAttributeDefinition("Scope");
var scopeTerm = new FilterTerm(scopeAttribute);
scopeTerm.Operate(FilterTerm.Operator.Equal, scopeVariable);
var superAndUpAttribute = epicType.GetAttributeDefinition("SuperAndUp").Filter(scopeTerm);
var superAndUpTerm = new FilterTerm(superAndUpAttribute);
superAndUpTerm.NotExists();
var filter = new AndFilterTerm(notClosedEpicTerm, scopeTerm, superAndUpTerm);
query.Filter = filter;
query.Variables.Add(scopeVariable);
var builder = new QueryURLBuilder(query);
var result = builder.ToString();
Assert.AreEqual("Data/Epic?sel=&where=(Epic.AssetState!='Closed';Epic.Scope=$Scope;-Epic.SuperAndUp[Scope=$Scope])&with=$Scope=Scope%3A2176", result);
}
示例10: HistoryAsOfTimeTest
public void HistoryAsOfTimeTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
var storyType = metaModel.GetAssetType("Story");
var query = new Query(storyType, true);
var nameAttribute = storyType.GetAttributeDefinition("Name");
var estimateAttribute = storyType.GetAttributeDefinition("Estimate");
query.Selection.Add(nameAttribute);
query.Selection.Add(estimateAttribute);
query.AsOf = DateTime.Now.AddDays(-7);
QueryResult result = services.Retrieve(query);
Assert.AreNotEqual(0, result.TotalAvaliable);
}
示例11: HistoryListOfAssetsTest
public void HistoryListOfAssetsTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
var memberType = metaModel.GetAssetType("Member");
var query = new Query(memberType, true);
var changeDateAttribute = memberType.GetAttributeDefinition("ChangeDate");
var emailAttribute = memberType.GetAttributeDefinition("Email");
query.Selection.Add(changeDateAttribute);
query.Selection.Add(emailAttribute);
var result = services.Retrieve(query);
Assert.AreNotEqual(0, result.TotalAvaliable);
}
示例12: HistorySingleAssetTest
public void HistorySingleAssetTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
var memberType = metaModel.GetAssetType("Member");
var idAttribute = memberType.GetAttributeDefinition("ID");
var changeDateAttribute = memberType.GetAttributeDefinition("ChangeDate");
var emailAttribute = memberType.GetAttributeDefinition("Email");
// the boolean parameter specifies we want the historical data
var query = new Query(memberType, true);
query.Selection.Add(changeDateAttribute);
query.Selection.Add(emailAttribute);
var idTerm = new FilterTerm(idAttribute);
idTerm.Equal("Member:20");
query.Filter = idTerm;
var result = services.Retrieve(query);
Assert.AreNotEqual(0, result.Assets.Count);
}
示例13: PageListOfAssetsTest
public void PageListOfAssetsTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
var storyType = metaModel.GetAssetType("Story");
var query = new Query(storyType) { Paging = { PageSize = 3, Start = 0 } };
var result = services.Retrieve(query);
Assert.AreEqual(3, result.Assets.Count);
// The PageSize property shown asks for 3 items, and the Start property indicates to start at 0.
// The next 3 items can be retrieved with PageSize=3, Start=3.
}
示例14: SortListOfAssetsTest
public void SortListOfAssetsTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
var assetType = metaModel.GetAssetType("Story");
var query = new Query(assetType);
var nameAttribute = assetType.GetAttributeDefinition("Name");
var estimateAttribute = assetType.GetAttributeDefinition("Estimate");
query.Selection.Add(nameAttribute);
query.Selection.Add(estimateAttribute);
query.OrderBy.MinorSort(estimateAttribute, OrderBy.Order.Ascending);
var result = services.Retrieve(query);
}
示例15: FindListOfAssetsTest
public void FindListOfAssetsTest()
{
IMetaModel metaModel = new MetaModel(new VersionOneAPIConnector(_metaUrl));
IServices services = new Services(
metaModel,
new VersionOneAPIConnector(_dataUrl).WithVersionOneUsernameAndPassword(_username, _password));
var assetType = metaModel.GetAssetType("Story");
var query = new Query(assetType);
var nameAttribute = assetType.GetAttributeDefinition("Name");
var priorityAttribute = assetType.GetAttributeDefinition("Priority");
query.Selection.Add(nameAttribute);
query.Selection.Add(priorityAttribute);
query.Find = new QueryFind("High");
var result = services.Retrieve(query);
result.Assets.ForEach(
asset => Assert.GreaterOrEqual(asset.GetAttribute(nameAttribute)
.Value
.ToString()
.IndexOf("High", StringComparison.OrdinalIgnoreCase)
, 0));
Assert.Greater(result.Assets.Count, 1);
}