public void TfsSinkUpdateWorkItemShouldNotUpdateAllFields() { var fieldMap = new Dictionary <string, object> { { "Title", "Dummy Title" }, // Title is a mandatory field for simulator { "Foo", "{{Topic1}}" }, { "Description", "{{deScriptIon}}" }, { "AreaPath", "Something" } }; var tfsSink = new TestableTfsSink(this.tfsServiceSimulator, new NetworkCredential(), this.parentWorkItemId, "Task", fieldMap); var issue = new Issue { Id = "issue2", Topic = "issue1Topic", Activity = 1 }; tfsSink.Configure(); tfsSink.UpdateWorkItem(issue).Should().BeTrue(); var workItem = this.tfsServiceSimulator.GetWorkItemForIssue("issue2", 1).Item as TfsServiceProviderSimulator.InMemoryWorkItem; Assert.IsNotNull(workItem); workItem["Title"].Should().Be("Dummy Title"); workItem["Foo"].Should().Be("{{Topic1}}"); workItem["Description"].Should().Be("{{deScriptIon}}"); workItem["AreaPath"] = "nothing"; // someone updates in the background var issue2 = new Issue { Id = "issue2", Topic = "issue1Topic", Activity = 2 }; tfsSink.UpdateWorkItem(issue2).Should().BeTrue(); workItem["AreaPath"].Should().Be("nothing"); // supa does not revert to "something" }
public void TfsSinkUpdateWorkItemShouldUpdateFieldsEvenIfWorkItemTypeIsNull() { var fieldMap = new Dictionary <string, object> { { "Title", "{{Topic}}" }, { "Description", "{{Description}}" }, { "IdField", "{{Id}}" }, { "ActivityCount", "{{Activity}}" } }; var tfsSink = new TestableTfsSink(this.tfsServiceSimulator, new NetworkCredential(), this.parentWorkItemId, null, fieldMap); var issue = new Issue { Id = "issue2", Topic = "issue1Topic", Activity = 1, Description = "descr" }; tfsSink.Configure(); tfsSink.UpdateWorkItem(issue).Should().BeTrue(); var workItem = this.tfsServiceSimulator.GetWorkItemForIssue("issue2", 1).Item as TfsServiceProviderSimulator.InMemoryWorkItem; Assert.IsNotNull(workItem); workItem["Title"].Should().Be("issue1Topic"); workItem["Description"].Should().Be("descr"); workItem["IdField"].Should().Be("issue2"); workItem["ActivityCount"].Should().Be("1"); }
public void InitializeTest() { this.testableTfsSink = new TestableTfsSink( this.tfsServiceSimulator, new NetworkCredential(), this.parentWorkItemId, "Task", new Dictionary <string, object>()); }
public void InitializeTest() { this.testableTfsSink = new TestableTfsSink( this.tfsServiceSimulator, new NetworkCredential(), this.parentWorkItemId, "Task", new Dictionary<string, object>()); }
public void TfsSinkConfigureShouldThrowIfParentWorkItemDoesNotExist() { var tfsSink = new TestableTfsSink( this.tfsServiceSimulator, new NetworkCredential(), -205, "Task", new Dictionary <string, object>()); Action action = () => tfsSink.Configure(); action.ShouldThrow <Exception>(); }
public void TfsSinkConfigureShouldThrowIfParentWorkItemDoesNotExist() { var tfsSink = new TestableTfsSink( this.tfsServiceSimulator, new NetworkCredential(), -205, "Task", new Dictionary<string, object>()); Action action = () => tfsSink.Configure(); action.ShouldThrow<Exception>(); }
public void TfsSinkUpdateWorkItemShouldUpdateFieldsIfTemplateTextDoesNotMatch() { var fieldMap = new Dictionary <string, object> { { "Title", "Dummy Title" }, // Title is a mandatory field for simulator { "Foo", "{{Topic1}}" }, { "Description", "{{deScriptIon}}" } }; var tfsSink = new TestableTfsSink(this.tfsServiceSimulator, new NetworkCredential(), this.parentWorkItemId, "Task", fieldMap); var issue = new Issue { Id = "issue2", Topic = "issue1Topic", Activity = 1 }; tfsSink.Configure(); tfsSink.UpdateWorkItem(issue).Should().BeTrue(); var workItem = this.tfsServiceSimulator.GetWorkItemForIssue("issue2", 1).Item as TfsServiceProviderSimulator.InMemoryWorkItem; Assert.IsNotNull(workItem); workItem["Title"].Should().Be("Dummy Title"); workItem["Foo"].Should().Be("{{Topic1}}"); workItem["Description"].Should().Be("{{deScriptIon}}"); }
public void TfsSinkUpdateWorkItemShouldUpdateFieldsIfWorkItemForIssueDoesNotExist() { var fieldMap = new Dictionary<string, object> { { "Title", "{{Topic}}" }, { "Description", "{{Description}}" }, { "IdField", "{{Id}}" }, { "ActivityCount", "{{Activity}}" } }; var tfsSink = new TestableTfsSink(this.tfsServiceSimulator, new NetworkCredential(), this.parentWorkItemId, "Task", fieldMap); var issue = new Issue { Id = "issue2", Topic = "issue1Topic", Activity = 1, Description = "descr" }; tfsSink.Configure(); tfsSink.UpdateWorkItem(issue).Should().BeTrue(); var workItem = this.tfsServiceSimulator.GetWorkItemForIssue("issue2", 1).Item as TfsServiceProviderSimulator.InMemoryWorkItem; Assert.IsNotNull(workItem); workItem["Title"].Should().Be("issue1Topic"); workItem["Description"].Should().Be("descr"); workItem["IdField"].Should().Be("issue2"); workItem["ActivityCount"].Should().Be("1"); }
public void TfsSinkUpdateWorkItemShouldUpdateFieldsIfTemplateTextDoesNotMatch() { var fieldMap = new Dictionary<string, object> { { "Title", "Dummy Title" }, // Title is a mandatory field for simulator { "Foo", "{{Topic1}}" }, { "Description", "{{deScriptIon}}" } }; var tfsSink = new TestableTfsSink(this.tfsServiceSimulator, new NetworkCredential(), this.parentWorkItemId, "Task", fieldMap); var issue = new Issue { Id = "issue2", Topic = "issue1Topic", Activity = 1 }; tfsSink.Configure(); tfsSink.UpdateWorkItem(issue).Should().BeTrue(); var workItem = this.tfsServiceSimulator.GetWorkItemForIssue("issue2", 1).Item as TfsServiceProviderSimulator.InMemoryWorkItem; Assert.IsNotNull(workItem); workItem["Title"].Should().Be("Dummy Title"); workItem["Foo"].Should().Be("{{Topic1}}"); workItem["Description"].Should().Be("{{deScriptIon}}"); }
public void TfsSinkUpdateWorkItemShouldNotUpdateAllFields() { var fieldMap = new Dictionary<string, object> { { "Title", "Dummy Title" }, // Title is a mandatory field for simulator { "Foo", "{{Topic1}}" }, { "Description", "{{deScriptIon}}" }, { "AreaPath", "Something"} }; var tfsSink = new TestableTfsSink(this.tfsServiceSimulator, new NetworkCredential(), this.parentWorkItemId, "Task", fieldMap); var issue = new Issue { Id = "issue2", Topic = "issue1Topic", Activity = 1 }; tfsSink.Configure(); tfsSink.UpdateWorkItem(issue).Should().BeTrue(); var workItem = this.tfsServiceSimulator.GetWorkItemForIssue("issue2", 1).Item as TfsServiceProviderSimulator.InMemoryWorkItem; Assert.IsNotNull(workItem); workItem["Title"].Should().Be("Dummy Title"); workItem["Foo"].Should().Be("{{Topic1}}"); workItem["Description"].Should().Be("{{deScriptIon}}"); workItem["AreaPath"] = "nothing"; // someone updates in the background var issue2 = new Issue { Id = "issue2", Topic = "issue1Topic", Activity = 2 }; tfsSink.UpdateWorkItem(issue2).Should().BeTrue(); workItem["AreaPath"].Should().Be("nothing"); // supa does not revert to "something" }