11using System ;
22using System . Collections . Generic ;
3+ using AwesomeAssertions ;
34using BO4E . BO ;
45using BO4E . COM ;
56using Microsoft . VisualStudio . TestTools . UnitTesting ;
@@ -21,33 +22,25 @@ public void TestGettingAndSetting()
2122 ) ;
2223 Assert . IsTrue ( marktlokation . TryGetExterneReferenz ( "foo" , out var actualBar ) ) ;
2324 Assert . AreEqual ( "bar" , actualBar ) ;
25+ var settingInvalidValues = ( ) =>
26+ marktlokation . SetExterneReferenz (
27+ new ExterneReferenz { ExRefName = null , ExRefWert = "nicht bar" }
28+ ) ;
29+ settingInvalidValues . Should ( ) . Throw < ArgumentException > ( ) ;
30+ var addingInvalidValues = ( ) =>
31+ marktlokation . SetExterneReferenz (
32+ new ExterneReferenz { ExRefName = "foo" , ExRefWert = null }
33+ ) ;
34+ addingInvalidValues . Should ( ) . Throw < ArgumentException > ( ) ;
35+ var addingNull = ( ) => marktlokation . SetExterneReferenz ( null ) ;
36+ addingNull . Should ( ) . Throw < ArgumentNullException > ( ) ;
2437
25- Assert . ThrowsException < ArgumentException > (
26- ( ) =>
27- marktlokation . SetExterneReferenz (
28- new ExterneReferenz { ExRefName = null , ExRefWert = "nicht bar" }
29- ) ,
30- "must not add invalid values"
31- ) ;
32- Assert . ThrowsException < ArgumentException > (
33- ( ) =>
34- marktlokation . SetExterneReferenz (
35- new ExterneReferenz { ExRefName = "foo" , ExRefWert = null }
36- ) ,
37- "must not add invalid values"
38- ) ;
39- Assert . ThrowsException < ArgumentNullException > (
40- ( ) => marktlokation . SetExterneReferenz ( null ) ,
41- "must not add null"
42- ) ;
38+ var settingConflictingDefaultValues = ( ) =>
39+ marktlokation . SetExterneReferenz (
40+ new ExterneReferenz { ExRefName = "foo" , ExRefWert = "nicht bar" }
41+ ) ;
42+ settingConflictingDefaultValues . Should ( ) . Throw < InvalidOperationException > ( ) ;
4343
44- Assert . ThrowsException < InvalidOperationException > (
45- ( ) =>
46- marktlokation . SetExterneReferenz (
47- new ExterneReferenz { ExRefName = "foo" , ExRefWert = "nicht bar" }
48- ) ,
49- "By default conflicting values are rejected"
50- ) ;
5144 marktlokation . SetExterneReferenz (
5245 new ExterneReferenz { ExRefName = "foo" , ExRefWert = "nicht bar" } ,
5346 true
0 commit comments