コード例 #1
0
        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"
        }
コード例 #2
0
        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");
        }
コード例 #3
0
 public void InitializeTest()
 {
     this.testableTfsSink = new TestableTfsSink(
         this.tfsServiceSimulator,
         new NetworkCredential(),
         this.parentWorkItemId,
         "Task",
         new Dictionary <string, object>());
 }
コード例 #4
0
ファイル: TfsSinkTests.cs プロジェクト: codito/supa
 public void InitializeTest()
 {
     this.testableTfsSink = new TestableTfsSink(
         this.tfsServiceSimulator,
         new NetworkCredential(),
         this.parentWorkItemId,
         "Task",
         new Dictionary<string, object>());
 }
コード例 #5
0
        public void TfsSinkConfigureShouldThrowIfParentWorkItemDoesNotExist()
        {
            var tfsSink = new TestableTfsSink(
                this.tfsServiceSimulator,
                new NetworkCredential(),
                -205,
                "Task",
                new Dictionary <string, object>());
            Action action = () => tfsSink.Configure();

            action.ShouldThrow <Exception>();
        }
コード例 #6
0
ファイル: TfsSinkTests.cs プロジェクト: codito/supa
        public void TfsSinkConfigureShouldThrowIfParentWorkItemDoesNotExist()
        {
            var tfsSink = new TestableTfsSink(
                this.tfsServiceSimulator,
                new NetworkCredential(),
                -205,
                "Task",
                new Dictionary<string, object>());
            Action action = () => tfsSink.Configure();

            action.ShouldThrow<Exception>();
        }
コード例 #7
0
        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}}");
        }
コード例 #8
0
ファイル: TfsSinkTests.cs プロジェクト: codito/supa
        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");
        }
コード例 #9
0
ファイル: TfsSinkTests.cs プロジェクト: codito/supa
        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}}");
        }
コード例 #10
0
ファイル: TfsSinkTests.cs プロジェクト: codito/supa
        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"
        }