Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MockWorkItem.Fields cannot be enumerated if initialzed with a constructor which takes field values #205

Open
pelavall opened this issue Jun 4, 2018 · 1 comment

Comments

@pelavall
Copy link
Contributor

pelavall commented Jun 4, 2018

When constructing MockWorkItem() and passing values for a field collection they are ultimately used in setting the private variable _fields on WorkItemCore which is the bases for retrieving fields via indexing. However the variable _fields in WorkItemCore is distinct from the _fields variable in Workitem, which backs the Fields property. In effect, MockWorkItem() enables initializing a workitem with retrievable values via workitem["property"] but not workitem.Fields["property"].Value, nor enumerating the values of the workitem.Fields property.

@pelavall
Copy link
Contributor Author

pelavall commented Jun 4, 2018

A work around for this is to set the desired values one at a time either using an object an initializer or setting the values one at a time after an initialization.

var workItem = new MockWorkItem(new MockWorkItemType("Bug"))
{
    ["Commit Available Branch"] = "a",
    ["Commit Available Build"] = "b",
    ["Current Release Build"] = "c",
    ["Current Flighting Build"] = "d",
    ["Resolved Reason"] = "e",
    ["Release"] = string.Empty,
    ["Product"] = string.Empty,
    ["Triage"] = string.Empty,
    ["Tags"] = string.Empty,
    ["Blocking"] = string.Empty
};

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant