Delete unit tests for the repos

This commit is contained in:
Sean Garrett
2023-06-16 17:20:04 +01:00
parent c6545b9448
commit f09cfc53c2
9 changed files with 938 additions and 17 deletions
@@ -161,6 +161,14 @@ namespace MongoDbGenericRepository
return MongoDbEraser.DeleteOne<TDocument, TKey>(document);
}
/// <inheritdoc />
public virtual long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return MongoDbEraser.DeleteOne<TDocument, TKey>(filter, partitionKey);
}
/// <inheritdoc />
public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(TDocument document)
where TDocument : IDocument<TKey>
@@ -177,21 +185,6 @@ namespace MongoDbGenericRepository
return await MongoDbEraser.DeleteOneAsync<TDocument, TKey>(document, cancellationToken);
}
/// <summary>
/// Deletes a document matching the condition of the LINQ expression filter.
/// </summary>
/// <typeparam name="TDocument">The type representing a Document.</typeparam>
/// <typeparam name="TKey">The type of the primary key for a Document.</typeparam>
/// <param name="filter">A LINQ expression filter.</param>
/// <param name="partitionKey">An optional partition key.</param>
/// <returns>The number of documents deleted.</returns>
public virtual long DeleteOne<TDocument, TKey>(Expression<Func<TDocument, bool>> filter, string partitionKey = null)
where TDocument : IDocument<TKey>
where TKey : IEquatable<TKey>
{
return MongoDbEraser.DeleteOne<TDocument, TKey>(filter, partitionKey);
}
/// <inheritdoc />
public virtual async Task<long> DeleteOneAsync<TDocument, TKey>(Expression<Func<TDocument, bool>> filter)
where TDocument : IDocument<TKey>