예제 #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"
        }