integration tested index management functionality
This commit is contained in:
@@ -9,16 +9,13 @@
|
||||
<PackageReference Include="Microsoft.Extensions.Identity.Stores" Version="2.1.2" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="15.8.0" />
|
||||
<PackageReference Include="MongoDB.Driver" Version="2.7.0" />
|
||||
<PackageReference Include="MongoDbGenericRepository" Version="1.3.8" />
|
||||
<PackageReference Include="xunit" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.console" Version="2.4.0" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.0" />
|
||||
<DotNetCliToolReference Include="dotnet-xunit" Version="2.3.0-beta4-build3742" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\MongoDbGenericRepository\MongoDbGenericRepository.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Configuration">
|
||||
<HintPath>..\..\..\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Configuration.dll</HintPath>
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -1053,6 +1054,25 @@ namespace CoreIntegrationTests.Infrastructure
|
||||
await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CreateCombinedTextIndexAsync()
|
||||
{
|
||||
// Arrange
|
||||
const string expectedIndexName = "SomeContent2_text_SomeContent3_text";
|
||||
|
||||
// Act
|
||||
Expression <Func<T, object>> ex = x => x.SomeContent2;
|
||||
Expression <Func<T, object>> ex2 = x => x.SomeContent3;
|
||||
var result = await SUT.CreateCombinedTextIndexAsync<T>(new[] { ex, ex2 }, null, PartitionKey);
|
||||
|
||||
// Assert
|
||||
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T>(PartitionKey);
|
||||
Assert.Contains(expectedIndexName, listOfIndexNames);
|
||||
|
||||
// Cleanup
|
||||
await SUT.DropIndexAsync<T>(expectedIndexName, PartitionKey);
|
||||
}
|
||||
|
||||
#endregion Index Management
|
||||
|
||||
#region Test Utils
|
||||
|
||||
@@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Linq.Expressions;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@@ -1046,6 +1047,25 @@ namespace CoreIntegrationTests.Infrastructure
|
||||
await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public async Task CreateCombinedTextIndexAsync()
|
||||
{
|
||||
// Arrange
|
||||
const string expectedIndexName = "SomeContent4_text_SomeContent5_text";
|
||||
|
||||
// Act
|
||||
Expression<Func<T, object>> ex = x => x.SomeContent4;
|
||||
Expression<Func<T, object>> ex2 = x => x.SomeContent5;
|
||||
var result = await SUT.CreateCombinedTextIndexAsync<T, TKey>(new[] { ex, ex2 }, null, PartitionKey);
|
||||
|
||||
// Assert
|
||||
var listOfIndexNames = await SUT.GetIndexesNamesAsync<T, TKey>(PartitionKey);
|
||||
Assert.Contains(expectedIndexName, listOfIndexNames);
|
||||
|
||||
// Cleanup
|
||||
await SUT.DropIndexAsync<T, TKey>(expectedIndexName, PartitionKey);
|
||||
}
|
||||
|
||||
#endregion Index Management
|
||||
|
||||
#region Test Utils
|
||||
|
||||
@@ -50,6 +50,8 @@ namespace CoreIntegrationTests.Infrastructure
|
||||
public int SomeValue { get; set; }
|
||||
|
||||
public string SomeContent { get; set; }
|
||||
public string SomeContent2 { get; set; }
|
||||
public string SomeContent3 { get; set; }
|
||||
|
||||
public int GroupingKey { get; set; }
|
||||
|
||||
@@ -78,6 +80,8 @@ namespace CoreIntegrationTests.Infrastructure
|
||||
}
|
||||
|
||||
public string SomeContent { get; set; }
|
||||
public string SomeContent4 { get; set; }
|
||||
public string SomeContent5 { get; set; }
|
||||
|
||||
public Nested Nested { get; set; }
|
||||
|
||||
|
||||
Reference in New Issue
Block a user