|
1 | | -/* Copyright 2010-2016 MongoDB Inc. |
| 1 | +/* Copyright 2010-2017 MongoDB Inc. |
2 | 2 | * |
3 | 3 | * Licensed under the Apache License, Version 2.0 (the "License"); |
4 | 4 | * you may not use this file except in compliance with the License. |
|
18 | 18 | using System.Linq; |
19 | 19 | using MongoDB.Bson; |
20 | 20 | using MongoDB.Bson.Serialization.Attributes; |
| 21 | +using MongoDB.Bson.TestHelpers.XunitExtensions; |
21 | 22 | using MongoDB.Driver; |
22 | 23 | using MongoDB.Driver.Builders; |
| 24 | +using MongoDB.Driver.Core.Clusters; |
| 25 | +using MongoDB.Driver.Core.TestHelpers.XunitExtensions; |
23 | 26 | using Xunit; |
24 | 27 |
|
25 | 28 | namespace MongoDB.Driver.Tests.Builders |
@@ -254,23 +257,18 @@ public void TestTextArrayNonArrayFields2() |
254 | 257 | Assert.Equal(expected, keys.ToJson()); |
255 | 258 | } |
256 | 259 |
|
257 | | - [Fact] |
| 260 | + [SkippableFact] |
258 | 261 | public void TestTextIndexCreation() |
259 | 262 | { |
260 | | - if (_primary.InstanceType != MongoServerInstanceType.ShardRouter) |
261 | | - { |
262 | | - if (_primary.Supports(FeatureId.TextSearchCommand)) |
263 | | - { |
264 | | - var collection = _database.GetCollection<Test>("test_text"); |
265 | | - collection.Drop(); |
266 | | - collection.CreateIndex(IndexKeys<Test>.Text(x => x.A, x => x.B).Ascending(x => x.C), IndexOptions.SetTextLanguageOverride("idioma").SetName("custom").SetTextDefaultLanguage("spanish")); |
267 | | - var indexes = collection.GetIndexes(); |
268 | | - var index = indexes.RawDocuments.Single(i => i["name"].AsString == "custom"); |
269 | | - Assert.Equal("idioma", index["language_override"].AsString); |
270 | | - Assert.Equal("spanish", index["default_language"].AsString); |
271 | | - Assert.Equal(1, index["key"]["c"].AsInt32); |
272 | | - } |
273 | | - } |
| 263 | + RequireServer.Check().VersionGreaterThanOrEqualTo("2.6.0").ClusterTypes(ClusterType.Standalone, ClusterType.ReplicaSet); |
| 264 | + var collection = _database.GetCollection<Test>("test_text"); |
| 265 | + collection.Drop(); |
| 266 | + collection.CreateIndex(IndexKeys<Test>.Text(x => x.A, x => x.B).Ascending(x => x.C), IndexOptions.SetTextLanguageOverride("idioma").SetName("custom").SetTextDefaultLanguage("spanish")); |
| 267 | + var indexes = collection.GetIndexes(); |
| 268 | + var index = indexes.RawDocuments.Single(i => i["name"].AsString == "custom"); |
| 269 | + Assert.Equal("idioma", index["language_override"].AsString); |
| 270 | + Assert.Equal("spanish", index["default_language"].AsString); |
| 271 | + Assert.Equal(1, index["key"]["c"].AsInt32); |
274 | 272 | } |
275 | 273 | } |
276 | 274 | } |
0 commit comments