tfsaggregator / tfsaggregator-webhooks

WARNING: the team is no more maintaing this version. See aggreggator-cli instead.
https://github.com/tfsaggregator/aggregator-cli
19 stars 22 forks source link

MakeNewWorkItem has bad code in it #28

Closed OgreBearing closed 6 years ago

OgreBearing commented 6 years ago
public IWorkItem MakeNewWorkItem(string projectName, string workItemTypeName)
{
 if (string.IsNullOrWhiteSpace(projectName))
 {
                throw new ArgumentNullException(nameof(projectName));
            }
            if (string.IsNullOrWhiteSpace(workItemTypeName))
            {
                throw new ArgumentNullException(nameof(workItemTypeName));
            }
            var targetType = this.workItemStore.Projects[projectName].WorkItemTypes[workItemTypeName];
            var target = new WorkItem(targetType);
            IWorkItem justCreated = new WorkItemWrapper(target, this.context);
            this.createdWorkItems.Add(justCreated);
            return justCreated;
        }
        public IWorkItem MakeNewWorkItem(IWorkItem inSameProjectAs, string workItemTypeName)
        {
            if (inSameProjectAs == null)
            {
                throw new ArgumentNullException(nameof(inSameProjectAs));
            }
            return this.MakeNewWorkItem(workItemTypeName, inSameProjectAs[CoreFieldReferenceNames.TeamProject] as string);
        }

See above, the call in the overloaded public IWorkItem MakeNewWorkItem(IWorkItem inSameProjectAs, string workItemTypeName) has the strings in the wrong order

jessehouwing commented 6 years ago

Is a know issue. Has been fixed in the tfsaggregator/develop repo.

On Fri, 27 Jul 2018, 11:10 sykobag, notifications@github.com wrote:

` public IWorkItem MakeNewWorkItem(string projectName, string workItemTypeName) { if (string.IsNullOrWhiteSpace(projectName)) { throw new ArgumentNullException(nameof(projectName)); }

    if (string.IsNullOrWhiteSpace(workItemTypeName))
    {
        throw new ArgumentNullException(nameof(workItemTypeName));
    }

    var targetType = this.workItemStore.Projects[projectName].WorkItemTypes[workItemTypeName];
    var target = new WorkItem(targetType);

    IWorkItem justCreated = new WorkItemWrapper(target, this.context);
    this.createdWorkItems.Add(justCreated);
    return justCreated;
}

public IWorkItem MakeNewWorkItem(IWorkItem inSameProjectAs, string workItemTypeName)
{
    if (inSameProjectAs == null)
    {
        throw new ArgumentNullException(nameof(inSameProjectAs));
    }

    return this.MakeNewWorkItem(workItemTypeName, inSameProjectAs[CoreFieldReferenceNames.TeamProject] as string);
}`

See above, the call in the overloaded public IWorkItem MakeNewWorkItem(IWorkItem inSameProjectAs, string workItemTypeName) has the strings in the wrong order

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/tfsaggregator/tfsaggregator-webhooks/issues/28, or mute the thread https://github.com/notifications/unsubscribe-auth/AD-uSxP6xk44TD-bf4feQ7peGtaqC_Eiks5uKtkZgaJpZM4VjK0H .

jessehouwing commented 6 years ago

Fixed here: https://github.com/tfsaggregator/tfsaggregator/blob/develop/Aggregator.Core/Aggregator.Core/Facade/WorkItemRepository.cs

jessehouwing commented 6 years ago

That's also where the very-latest version of the tfsaggregator-webhooks now lives. I got fed up with the sub modules.

OgreBearing commented 6 years ago

Ah, yep, found the good stuff now, thanks!