-
-
Notifications
You must be signed in to change notification settings - Fork 467
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Exposing the IgnoreIndex() functionality to the public configuation A…
…PI. Closes GH-2247
- Loading branch information
Jeremy D. Miller
authored and
Jeremy D. Miller
committed
May 26, 2022
1 parent
0323496
commit f01b4b7
Showing
4 changed files
with
289 additions
and
174 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
src/DocumentDbTests/Configuration/ignoring_indexes_on_document_table.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Linq; | ||
using Marten; | ||
using Marten.Schema; | ||
using Marten.Storage; | ||
using Marten.Testing.Documents; | ||
using Marten.Testing.Harness; | ||
using Shouldly; | ||
using Xunit; | ||
|
||
namespace DocumentDbTests.Configuration | ||
{ | ||
public class ignoring_indexes_on_document_table : OneOffConfigurationsContext | ||
{ | ||
[Fact] | ||
public void index_is_ignored_on_document_table() | ||
{ | ||
var mapping = DocumentMapping.For<User>(); | ||
mapping.IgnoreIndex("foo"); | ||
|
||
var table = new DocumentTable(mapping); | ||
table.IgnoredIndexes.Any(x => x == "foo").ShouldBeTrue(); | ||
} | ||
|
||
[Fact] | ||
public void ignore_index_through_configuration() | ||
{ | ||
var store = DocumentStore.For(opts => | ||
{ | ||
opts.Connection(ConnectionSource.ConnectionString); | ||
opts.Schema.For<User>().IgnoreIndex("foo"); | ||
}); | ||
|
||
var mapping = store.Options.Storage.MappingFor(typeof(User)); | ||
new DocumentTable(mapping).IgnoredIndexes.Single().ShouldBe("foo"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.