added objectid tests

This commit is contained in:
Alexandre SPIESER
2019-04-14 20:18:37 +01:00
parent 8ccced66ea
commit d2df667b3f
4 changed files with 36 additions and 7 deletions
@@ -1,10 +1,13 @@
using CoreIntegrationTests.Infrastructure; using CoreIntegrationTests.Infrastructure;
using MongoDB.Bson;
using MongoDbGenericRepository.Attributes; using MongoDbGenericRepository.Attributes;
using MongoDbGenericRepository.Models; using MongoDbGenericRepository.Models;
using System; using System;
namespace CoreIntegrationTests namespace CoreIntegrationTests
{ {
#region Guid Type
[CollectionName("TestingCNameAttrPartTKey")] [CollectionName("TestingCNameAttrPartTKey")]
public class CoreTKeyPartitionedCollectionNameDoc : TestDoc<Guid>, IPartitionedDocument public class CoreTKeyPartitionedCollectionNameDoc : TestDoc<Guid>, IPartitionedDocument
{ {
@@ -28,4 +31,35 @@ namespace CoreIntegrationTests
return "CoreCRUDTKeyPartitionedCollectionNameAttributeTests"; return "CoreCRUDTKeyPartitionedCollectionNameAttributeTests";
} }
} }
#endregion Guid Type
#region ObjectId Type
[CollectionName("TestingCNameAttrPartObjectId")]
public class CoreObjectIdPartitionedCollectionNameDoc : TestDoc<ObjectId>, IPartitionedDocument
{
public CoreObjectIdPartitionedCollectionNameDoc()
{
PartitionKey = "CoreTestPartitionKeyObjectId";
}
public string PartitionKey { get; set; }
}
public class CRUDObjectIdPartitionedCollectionNameAttributeTests : MongoDbTKeyDocumentTestBase<CoreObjectIdPartitionedCollectionNameDoc, ObjectId>
{
public CRUDObjectIdPartitionedCollectionNameAttributeTests(MongoDbTestFixture<CoreObjectIdPartitionedCollectionNameDoc, ObjectId> fixture) : base(fixture)
{
}
public override string GetClassName()
{
return "CoreCRUDTKeyPartitionedCollectionNameAttributeTests";
}
}
#endregion ObjectId Type
} }
-1
View File
@@ -11,7 +11,6 @@ namespace CoreIntegrationTests
{ {
public CRUDTests(MongoDbTestFixture<CoreTestDocument, Guid> fixture) : base(fixture) public CRUDTests(MongoDbTestFixture<CoreTestDocument, Guid> fixture) : base(fixture)
{ {
} }
public override string GetClassName() public override string GetClassName()
@@ -5,13 +5,11 @@ using System.Collections.Concurrent;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace CoreIntegrationTests.Infrastructure namespace CoreIntegrationTests.Infrastructure
{ {
public class MongoDbTestFixture<T, TKey> : IDisposable public class MongoDbTestFixture<T, TKey> : IDisposable
where T : IDocument<TKey>, new() where T : IDocument<TKey>, new()
where TKey : IEquatable<TKey> where TKey : IEquatable<TKey>
{ {
public IMongoDbContext Context; public IMongoDbContext Context;
@@ -39,7 +39,6 @@ namespace MongoDbGenericRepository
{ {
} }
/// <summary> /// <summary>
/// Asynchronously returns a paginated list of the documents matching the filter condition. /// Asynchronously returns a paginated list of the documents matching the filter condition.
/// </summary> /// </summary>
@@ -71,7 +70,6 @@ namespace MongoDbGenericRepository
.ToListAsync(); .ToListAsync();
} }
/// <summary> /// <summary>
/// Asynchronously returns a paginated list of the documents matching the filter condition. /// Asynchronously returns a paginated list of the documents matching the filter condition.
/// </summary> /// </summary>