File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
src/redmine-net-api/Internals Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change
1
+ using System ;
2
+
3
+ namespace Redmine . Net . Api . Internals ;
4
+
5
+ /// <summary>
6
+ ///
7
+ /// </summary>
8
+ internal static class ParameterValidator
9
+ {
10
+ public static void ValidateNotNull < T > ( T parameter , string parameterName )
11
+ where T : class
12
+ {
13
+ if ( parameter is null )
14
+ {
15
+ throw new ArgumentNullException ( parameterName ) ;
16
+ }
17
+ }
18
+
19
+ public static void ValidateNotNullOrEmpty ( string parameter , string parameterName )
20
+ {
21
+ if ( string . IsNullOrEmpty ( parameter ) )
22
+ {
23
+ throw new ArgumentException ( "Value cannot be null or empty" , parameterName ) ;
24
+ }
25
+ }
26
+
27
+ public static void ValidateId ( int id , string parameterName )
28
+ {
29
+ if ( id <= 0 )
30
+ {
31
+ throw new ArgumentException ( "Id must be greater than 0" , parameterName ) ;
32
+ }
33
+ }
34
+ }
You can’t perform that action at this time.
0 commit comments