예제 #1
0
            public static void IsValidGitObject(GitNamedObjectWithLifetime gitObject, Repository repository, string parameterName)
            {
                Assert.IsNotNull(repository);
                Assert.IsNeitherNullNorWhitespace(parameterName);

                if (gitObject == null)
                {
                    throw new ArgumentNullException(parameterName);
                }
                if (gitObject.Repository != repository)
                {
                    throw new ArgumentException(
                              string.Format(
                                  CultureInfo.InvariantCulture,
                                  Resources.ExcSuppliedObjectIsNotHandledByThisRepository,
                                  gitObject.GetType().Name),
                              parameterName);
                }
                if (gitObject.IsDeleted)
                {
                    throw new ArgumentException(
                              string.Format(
                                  CultureInfo.InvariantCulture,
                                  Resources.ExcSuppliedObjectIsDeleted,
                                  gitObject.GetType().Name),
                              parameterName);
                }
            }
예제 #2
0
            /// <summary>Verifies that object is not deleted.</summary>
            /// <param name="gitObject">Object to verify.</param>
            /// <exception cref="InvalidOperationException">
            /// <paramref name="gitObject"/> is deleted.
            /// </exception>
            public static void IsNotDeleted(GitNamedObjectWithLifetime gitObject)
            {
                Assert.IsNotNull(gitObject);

                if (gitObject.IsDeleted)
                {
                    throw new InvalidOperationException(
                              string.Format(
                                  CultureInfo.InvariantCulture,
                                  Resources.ExcObjectIsDeleted,
                                  gitObject.GetType().Name));
                }
            }