@@ -35,7 +35,7 @@ public static void ArgumentNotNullOrEmptyEnumerable<T>(IEnumerable<T> argumentVa
3535 {
3636 ArgumentNotNull ( argumentValue , argumentName ) ;
3737
38- if ( argumentValue . Count ( ) == 0 )
38+ if ( ! argumentValue . Any ( ) )
3939 {
4040 throw new ArgumentException ( "Enumerable cannot be empty" , argumentName ) ;
4141 }
@@ -50,7 +50,7 @@ public static void ArgumentNotNullOrEmptyString(string argumentValue, string arg
5050 {
5151 ArgumentNotNull ( argumentValue , argumentName ) ;
5252
53- if ( argumentValue . Trim ( ) . Length == 0 )
53+ if ( String . IsNullOrWhiteSpace ( argumentValue ) )
5454 {
5555 throw new ArgumentException ( "String cannot be empty" , argumentName ) ;
5656 }
@@ -145,17 +145,15 @@ public static void ZeroResult(int result)
145145 }
146146
147147 /// <summary>
148- /// Check that the result of a C call that returns a boolean value
149- /// was successful
148+ /// Check that the result of a C call returns a boolean value.
150149 /// <para>
151- /// The native function is expected to return strictly 0 for
152- /// success or a negative value in the case of failure.
150+ /// The native function is expected to return strictly 0 or 1.
153151 /// </para>
154152 /// </summary>
155153 /// <param name="result">The result to examine.</param>
156154 public static void BooleanResult ( int result )
157155 {
158- if ( result == ( int ) GitErrorCode . Ok || result == 1 )
156+ if ( result == 0 || result == 1 )
159157 {
160158 return ;
161159 }
@@ -164,11 +162,11 @@ public static void BooleanResult(int result)
164162 }
165163
166164 /// <summary>
167- /// Check that the result of a C call that returns an integer value
168- /// was successful
165+ /// Check that the result of a C call that returns an integer
166+ /// value was successful.
169167 /// <para>
170- /// The native function is expected to return strictly 0 for
171- /// success or a negative value in the case of failure.
168+ /// The native function is expected to return 0 or a positive
169+ /// value for success or a negative value in the case of failure.
172170 /// </para>
173171 /// </summary>
174172 /// <param name="result">The result to examine.</param>
@@ -182,16 +180,6 @@ public static void Int32Result(int result)
182180 HandleError ( result ) ;
183181 }
184182
185- public static void NotNullResult ( Object result )
186- {
187- if ( result != null )
188- {
189- return ;
190- }
191-
192- HandleError ( ( int ) GitErrorCode . Error ) ;
193- }
194-
195183 /// <summary>
196184 /// Checks an argument by applying provided checker.
197185 /// </summary>
@@ -208,6 +196,15 @@ public static void ArgumentConformsTo<T>(T argumentValue, Func<T, bool> checker,
208196 throw new ArgumentException ( argumentName ) ;
209197 }
210198
199+ /// <summary>
200+ /// Check that the result of a C call that returns a non-null GitObject
201+ /// using the default exception builder.
202+ /// <para>
203+ /// The native function is expected to return a valid object value.
204+ /// </para>
205+ /// </summary>
206+ /// <param name="gitObject">The <see cref="GitObject"/> to examine.</param>
207+ /// <param name="identifier">The <see cref="GitObject"/> identifier to examine.</param>
211208 public static void GitObjectIsNotNull ( GitObject gitObject , string identifier )
212209 {
213210 Func < string , LibGit2SharpException > exceptionBuilder ;
@@ -224,6 +221,17 @@ public static void GitObjectIsNotNull(GitObject gitObject, string identifier)
224221 GitObjectIsNotNull ( gitObject , identifier , exceptionBuilder ) ;
225222 }
226223
224+
225+ /// <summary>
226+ /// Check that the result of a C call that returns a non-null GitObject
227+ /// using the default exception builder.
228+ /// <para>
229+ /// The native function is expected to return a valid object value.
230+ /// </para>
231+ /// </summary>
232+ /// <param name="gitObject">The <see cref="GitObject"/> to examine.</param>
233+ /// <param name="identifier">The <see cref="GitObject"/> identifier to examine.</param>
234+ /// <param name="exceptionBuilder">The builder which constructs an <see cref="LibGit2SharpException"/> from a message.</param>
227235 public static void GitObjectIsNotNull (
228236 GitObject gitObject ,
229237 string identifier ,
0 commit comments