@@ -405,6 +405,50 @@ public void GetBoolean_IncorrectKey_ReturnDefault() {
405405
406406 }
407407
408+ /*==========================================================================================================================
409+ | TEST: GET URI: INHERITED VALUE: IS RETURNED
410+ \-------------------------------------------------------------------------------------------------------------------------*/
411+ /// <summary>
412+ /// Ensures that URI values can be set and retrieved as expected via inheritance, both via <see cref="Topic.Parent"/>
413+ /// and <see cref="Topic.BaseTopic"/>.
414+ /// </summary>
415+ [ Fact ]
416+ public void GetUri_InheritedValue_IsReturned ( ) {
417+
418+ var baseTopic = new Topic ( "Base" , "Container" ) ;
419+ var topic = new Topic ( "Test" , "Container" ) ;
420+ var childTopic = new Topic ( "Child" , "Container" , topic ) ;
421+ var url = "https://www.github.com/OnTopicCMS/" ;
422+ var uri = new Uri ( url ) ;
423+
424+ topic . BaseTopic = baseTopic ;
425+
426+ baseTopic . Attributes . SetUri ( "Url" , uri ) ;
427+
428+ Assert . Equal ( uri , topic . Attributes . GetUri ( "Url" ) ) ;
429+ Assert . Equal ( uri , childTopic . Attributes . GetUri ( "Url" , inheritFromParent : true ) ) ;
430+ Assert . Null ( topic . Attributes . GetUri ( "Url" , inheritFromBase : false ) ) ;
431+
432+ }
433+
434+ /*==========================================================================================================================
435+ | TEST: GET URI: INCORRECT VALUE: RETURN DEFAULT
436+ \-------------------------------------------------------------------------------------------------------------------------*/
437+ /// <summary>
438+ /// Ensures that invalid values return the default.
439+ /// </summary>
440+ [ Fact ]
441+ public void GetUri_IncorrectValue_ReturnDefault ( ) {
442+
443+ var topic = new Topic ( "Test" , "Container" ) ;
444+ var url = "https://www.github.com/OnTopicCMS/" ;
445+ var uri = new Uri ( url ) ;
446+
447+ Assert . Null ( topic . Attributes . GetUri ( "InvalidUrl" ) ) ;
448+ Assert . Equal ( uri , topic . Attributes . GetUri ( "InvalidUrl" , uri ) ) ;
449+
450+ }
451+
408452 /*==========================================================================================================================
409453 | TEST: SET VALUE: CORRECT VALUE: IS RETURNED
410454 \-------------------------------------------------------------------------------------------------------------------------*/
0 commit comments