internal static WorkItemAPI GetInstance([CallerMemberName] string callerName = "") { var instance = new WorkItemAPI(); InstanceFactory(ref instance, callerName); return(instance); }
public void Save_UnitTest() { var api = new WorkItemAPI(); var fieldValues = new List <KeyValuePair <string, object> > { new KeyValuePair <string, object>("System.Title", "Save Testing") }; IWorkItem instance = api.BuildWorkItem("RestPlaypen", "Task", fieldValues); Assert.AreEqual(-1, instance.Id); Assert.AreEqual(-1, instance.Rev); IField originalIdField = instance.Fields["System.Id"]; IField originalRevField = instance.Fields["System.Rev"]; Assert.AreEqual(-1, originalRevField.Value); instance.Save(); Assert.IsTrue(instance.Id > 0); Assert.AreEqual(1, instance.Rev); IField updatedIdField = instance.Fields["System.Id"]; Assert.AreEqual(instance.Id, (int)(Int64)updatedIdField.Value); Assert.AreSame(originalIdField, updatedIdField); IField updatedRevField = instance.Fields["System.Rev"]; Assert.AreEqual(instance.Rev, (int)(Int64)updatedRevField.Value); Assert.AreSame(originalRevField, updatedRevField); }
/// <summary> /// Builds the work item_ pre condition. /// </summary> /// <param name="instance">The instance.</param> /// <param name="projectName">Name of the project.</param> /// <param name="workItemType">Type of the work item.</param> /// <param name="fieldValues">The field values.</param> partial void BuildWorkItem_PreCondition(WorkItemAPI instance, ref String projectName, ref String workItemType, ref IReadOnlyList <KeyValuePair <String, Object> > fieldValues) { projectName = "RestPlaypen"; workItemType = "Task"; var values = new List <KeyValuePair <string, object> >(); values.Add(new KeyValuePair <string, object>("System.Title", "Task Created from UnitTest")); fieldValues = values; }
/// <summary> /// Creates the work item_ pre condition. /// </summary> /// <param name="instance">The instance.</param> /// <param name="project">The project.</param> /// <param name="workItem">The work item.</param> partial void CreateWorkItem_PreCondition(WorkItemAPI instance, ref String project, ref IWorkItem workItem) { project = "RestPlaypen"; workItem = new FauxWorkItem { Type = new FauxWorkItemType { Name = "Task" } }; }
partial void GetWorkItems_PreCondition(WorkItemAPI instance, ref IEnumerable <Int32> ids);
partial void GetWorkItems_PostValidate(WorkItemAPI instance, IEnumerable <Int32> ids, Task <IReadOnlyList <IWorkItem> > _retVal);
partial void GetAreas_PreCondition(WorkItemAPI instance, ref String project, ref Int32 depth);
partial void GetHashCode_PostValidate(WorkItemAPI instance, Int32 _retVal);
/// <summary> /// Wiqls the query_ pre condition. /// </summary> /// <param name="instance">The instance.</param> /// <param name="wiql">The wiql.</param> /// <param name="fullyPopulate">The fully populate.</param> partial void WiqlQuery_PreCondition(WorkItemAPI instance, ref String wiql, ref Boolean fullyPopulate) { wiql = "SELECT * FROM WorkItems WHERE [System.TeamProject] = 'RestPlaypen' ORDER BY [System.Id] "; }
partial void WiqlQuery_PreCondition(WorkItemAPI instance, ref String wiql, ref Boolean fullyPopulate);
partial void ToString_PreCondition(WorkItemAPI instance);
partial void GetRelationTypes_PostValidate(WorkItemAPI instance, Task <IReadOnlyList <IRelationType> > _retVal);
partial void GetLinksForWorkItem_PreCondition(WorkItemAPI instance, ref IWorkItem workItem);
partial void GetLinksForWorkItem_PostValidate(WorkItemAPI instance, IWorkItem workItem, Task <ILinkCollection> _retVal);
partial void GetIterations_PostValidate(WorkItemAPI instance, String project, Int32 depth, Task <IReadOnlyList <IIteration> > _retVal);
partial void GetFieldDefinitions_PostValidate(WorkItemAPI instance, Task <IReadOnlyList <IFieldDefinition> > _retVal);
partial void GetHashCode_PreCondition(WorkItemAPI instance);
static partial void InstanceFactory(ref WorkItemAPI instance, [CallerMemberName] string callerName = "");
partial void ToString_PostValidate(WorkItemAPI instance, String _retVal);
partial void GetRelationTypes_PreCondition(WorkItemAPI instance);
partial void WiqlQuery_PostValidate(WorkItemAPI instance, String wiql, Boolean fullyPopulate, Task <IReadOnlyList <IWorkItem> > _retVal);
partial void GetType_PostValidate(WorkItemAPI instance, Type _retVal);
/// <summary> /// Gets the work items_ pre condition. /// </summary> /// <param name="instance">The instance.</param> /// <param name="ids">The ids.</param> partial void GetWorkItems_PreCondition(WorkItemAPI instance, ref IEnumerable <Int32> ids) { ids = new List <int> { 1, 2, 3 }; }
/// <summary> /// Gets the work item types_ post validate. /// </summary> /// <param name="instance">The instance.</param> /// <param name="project">The project.</param> /// <param name="_retVal">The _ret value.</param> partial void GetWorkItemTypes_PostValidate(WorkItemAPI instance, String project, Task <IReadOnlyDictionary <String, IWorkItemType> > _retVal) { project = "RestPlaypen"; }
partial void GetType_PreCondition(WorkItemAPI instance);
partial void GetFieldDefinitions_PreCondition(WorkItemAPI instance);
/// <summary> /// Gets the iterations_ pre condition. /// </summary> /// <param name="instance">The instance.</param> /// <param name="project">The project.</param> /// <param name="depth">The depth.</param> partial void GetIterations_PreCondition(WorkItemAPI instance, ref String project, ref Int32 depth) { project = "RestPlaypen"; }
partial void GetWorkItemTypeCategories_PostValidate(WorkItemAPI instance, String project, Task <IReadOnlyList <ICategory> > _retVal);
/// <summary> /// Gets the work item types_ pre condition. /// </summary> /// <param name="instance">The instance.</param> /// <param name="project">The project.</param> partial void GetWorkItemTypes_PreCondition(WorkItemAPI instance, ref String project) { project = "RestPlaypen"; }
partial void GetWorkItemTypes_PreCondition(WorkItemAPI instance, ref String project);