Ejemplo n.º 1
0
            public void Should_Get_Valid_Properties()
            {
                // Given
                var tfsThread = new TfsPullRequestCommentThread(
                    new GitPullRequestCommentThread
                {
                    Id         = 42,
                    Status     = CommentThreadStatus.Active,
                    Properties = new PropertiesCollection {
                        { "one", "way" }, { "two", 2 }
                    },
                });

                // When
                var prop1 = tfsThread.GetValue <string>("one");
                var prop2 = tfsThread.GetValue <int>("two");
                var prop3 = tfsThread.GetValue <object>("ghost");

                // Then
                prop1.ShouldNotBeNull();
                prop1.ShouldBeOfType <string>();
                prop1.ShouldNotBeEmpty();
                prop1.ShouldBe("way");

                prop2.ShouldNotBeNull();
                prop2.ShouldBeOfType <int>();
                prop2.ShouldBe(2);

                prop3.ShouldBeNull();
            }
Ejemplo n.º 2
0
            public void Should_Throw_If_Property_Name_Is_Empty()
            {
                // Given
                var tfsThread = new TfsPullRequestCommentThread();

                // When
                var result = Record.Exception(() => tfsThread.GetValue <object>(string.Empty));

                // Then
                result.IsArgumentOutOfRangeException("propertyName");
            }
Ejemplo n.º 3
0
            public void Should_Return_Default_Value_If_Property_Collection_Is_Null_For_Integer_Value()
            {
                // Given
                var tfsThread = new TfsPullRequestCommentThread();

                // When
                var result = tfsThread.GetValue <int>("key");

                // Then
                result.ShouldBe(default(int));
            }
Ejemplo n.º 4
0
            public void Should_Throw_If_Property_Name_Is_Null()
            {
                // Given
                var tfsThread = new TfsPullRequestCommentThread();

                // When
                var result = Record.Exception(() => tfsThread.GetValue <string>(null));

                // Then
                result.IsArgumentNullException("propertyName");
            }
Ejemplo n.º 5
0
            public void Should_Return_Default_Value_If_Property_Does_Not_Exist_For_Int_Value()
            {
                // Given
                var tfsThread = new TfsPullRequestCommentThread(
                    new GitPullRequestCommentThread
                {
                    Id         = 42,
                    Status     = CommentThreadStatus.Active,
                    Properties = new PropertiesCollection(),
                });

                // When
                var result = tfsThread.GetValue <int>("key");

                // Then
                result.ShouldBe(default(int));
            }