@@ -120,6 +120,26 @@ public void AddChildToScalarThrowsInvalidOperationException()
120120 Throws . InstanceOf < InvalidOperationException > ( ) ) ;
121121 }
122122
123+ [ Test ]
124+ public void RemoveFromScalarThrowsInvalidOperationException ( )
125+ {
126+ var obj = new KVObject ( "hello" ) ;
127+
128+ Assert . That (
129+ ( ) => obj . Remove ( "child" ) ,
130+ Throws . InstanceOf < InvalidOperationException > ( ) ) ;
131+ }
132+
133+ [ Test ]
134+ public void ClearOnScalarThrowsInvalidOperationException ( )
135+ {
136+ var obj = new KVObject ( "hello" ) ;
137+
138+ Assert . That (
139+ ( ) => obj . Clear ( ) ,
140+ Throws . InstanceOf < InvalidOperationException > ( ) ) ;
141+ }
142+
123143 #endregion
124144
125145 #region Add(KVObject) to non-array throws
@@ -601,23 +621,23 @@ public void IndexerSetOnArrayThrowsInvalidOperationException()
601621
602622 #endregion
603623
604- #region Remove on scalar and array returns false
624+ #region Remove on scalar and array throws
605625
606626 [ Test ]
607- public void RemoveOnScalarReturnsFalse ( )
627+ public void RemoveOnScalarThrows ( )
608628 {
609629 var obj = new KVObject ( "hello" ) ;
610630
611- Assert . That ( obj . Remove ( "anything" ) , Is . False ) ;
631+ Assert . That ( ( ) => obj . Remove ( "anything" ) , Throws . InstanceOf < InvalidOperationException > ( ) ) ;
612632 }
613633
614634 [ Test ]
615- public void RemoveOnArrayReturnsFalse ( )
635+ public void RemoveOnArrayThrows ( )
616636 {
617637 var arr = KVObject . Array ( ) ;
618638 arr . Add ( 1 ) ;
619639
620- Assert . That ( arr . Remove ( "anything" ) , Is . False ) ;
640+ Assert . That ( ( ) => arr . Remove ( "anything" ) , Throws . InstanceOf < InvalidOperationException > ( ) ) ;
621641 }
622642
623643 #endregion
@@ -659,17 +679,14 @@ public void IndexerSetNullOnMissingKeyInDictCollectionStoresNullValue()
659679
660680 #endregion
661681
662- #region Clear on scalar is no-op
682+ #region Clear on scalar throws
663683
664684 [ Test ]
665- public void ClearOnScalarIsNoOp ( )
685+ public void ClearOnScalarThrows ( )
666686 {
667687 var obj = new KVObject ( 42 ) ;
668688
669- obj . Clear ( ) ;
670-
671- Assert . That ( ( int ) obj , Is . EqualTo ( 42 ) ) ;
672- Assert . That ( obj . ValueType , Is . EqualTo ( KVValueType . Int32 ) ) ;
689+ Assert . That ( ( ) => obj . Clear ( ) , Throws . InstanceOf < InvalidOperationException > ( ) ) ;
673690 }
674691
675692 #endregion
0 commit comments