本文整理汇总了C#中CreateCollectionOperation类的典型用法代码示例。如果您正苦于以下问题:C# CreateCollectionOperation类的具体用法?C# CreateCollectionOperation怎么用?C# CreateCollectionOperation使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
CreateCollectionOperation类属于命名空间,在下文中一共展示了CreateCollectionOperation类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Capped_should_work
public void Capped_should_work()
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
subject.Capped.Should().NotHaveValue();
subject.Capped = true;
subject.Capped.Should().BeTrue();
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:9,代码来源:CreateCollectionOperationTests.cs
示例2: Capped_get_and_set_should_work
public void Capped_get_and_set_should_work(
[Values(null, false, true)]
bool? value)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
subject.Capped = value;
var result = subject.Capped;
result.Should().Be(value);
}
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:11,代码来源:CreateCollectionOperationTests.cs
示例3: Collation_get_and_set_should_work
public void Collation_get_and_set_should_work(
[Values(null, "en_US", "fr_CA")]
string locale)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
var value = locale == null ? null : new Collation(locale);
subject.Collation = value;
var result = subject.Collation;
result.Should().BeSameAs(value);
}
开发者ID:mfidemraizer,项目名称:mongo-csharp-driver,代码行数:12,代码来源:CreateCollectionOperationTests.cs
示例4: constructor_should_initialize_subject
public void constructor_should_initialize_subject()
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
subject.AutoIndexId.Should().NotHaveValue();
subject.Capped.Should().NotHaveValue();
subject.CollectionNamespace.Should().BeSameAs(_collectionNamespace);
subject.MaxDocuments.Should().NotHaveValue();
subject.MaxSize.Should().NotHaveValue();
subject.MessageEncoderSettings.Should().BeSameAs(_messageEncoderSettings);
subject.UsePowerOf2Sizes.Should().NotHaveValue();
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:12,代码来源:CreateCollectionOperationTests.cs
示例5: Execute_should_create_collection_when_Validator_is_set
public void Execute_should_create_collection_when_Validator_is_set(
[Values(false, true)] bool async)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings)
{
ValidationAction = DocumentValidationAction.Error,
ValidationLevel = DocumentValidationLevel.Strict,
Validator = new BsonDocument("_id", new BsonDocument("$exists", true))
};
using (var binding = CoreTestConfiguration.GetReadWriteBinding())
{
var result = ExecuteOperation(subject, binding, async);
result["ok"].ToBoolean().Should().BeTrue();
var collectionInfo = GetCollectionInfo(binding, _collectionNamespace.CollectionName);
Assert.That(collectionInfo["options"]["validator"], Is.EqualTo(new BsonDocument("_id", new BsonDocument("$exists", true))));
Assert.That(collectionInfo["options"]["validationAction"].AsString, Is.EqualTo("error"));
Assert.That(collectionInfo["options"]["validationLevel"].AsString, Is.EqualTo("strict"));
}
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:21,代码来源:CreateCollectionOperationTests.cs
示例6: Execute_should_create_collection_when_UsePowerOf2Sizes_is_set
public void Execute_should_create_collection_when_UsePowerOf2Sizes_is_set(
[Values(false, true)]
bool usePowerOf2Sizes,
[Values(false, true)]
bool async)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings)
{
UsePowerOf2Sizes = usePowerOf2Sizes
};
using (var binding = CoreTestConfiguration.GetReadWriteBinding())
{
var result = ExecuteOperation(subject, binding, async);
result["ok"].ToBoolean().Should().BeTrue();
var stats = GetCollectionStats(binding, async);
stats["ns"].ToString().Should().Be(_collectionNamespace.FullName);
stats["userFlags"].ToInt32().Should().Be(usePowerOf2Sizes ? 1 : 0);
}
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:22,代码来源:CreateCollectionOperationTests.cs
示例7: ExecuteOperation
private BsonDocument ExecuteOperation(CreateCollectionOperation subject, IWriteBinding binding, bool async)
{
if (async)
{
return subject.ExecuteAsync(binding, CancellationToken.None).GetAwaiter().GetResult();
}
else
{
return subject.Execute(binding, CancellationToken.None);
}
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:11,代码来源:CreateCollectionOperationTests.cs
示例8: MaxSize_set_should_throw_when_value_is_invalid
public void MaxSize_set_should_throw_when_value_is_invalid(
[Values(-1, 0)]
long maxSize)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
Action action = () => { subject.MaxSize = maxSize; };
action.ShouldThrow<ArgumentOutOfRangeException>().And.ParamName.Should().Equals("value");
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:10,代码来源:CreateCollectionOperationTests.cs
示例9: CreateCommand_should_return_expected_result_when_Capped_is_set
public void CreateCommand_should_return_expected_result_when_Capped_is_set(
[Values(false, true)]
bool capped)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings)
{
Capped = capped
};
var expectedResult = new BsonDocument
{
{ "create", _collectionNamespace.CollectionName },
{ "capped", capped }
};
var result = subject.CreateCommand();
result.Should().Be(expectedResult);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:18,代码来源:CreateCollectionOperationTests.cs
示例10: CreateCommand_should_return_expected_result_when_Validator_is_set
public void CreateCommand_should_return_expected_result_when_Validator_is_set()
{
var value = new BsonDocument("x", 1);
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings)
{
Validator = value
};
var expectedResult = new BsonDocument
{
{ "create", _collectionNamespace.CollectionName },
{ "validator", value }
};
var result = subject.CreateCommand();
result.Should().Be(expectedResult);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:17,代码来源:CreateCollectionOperationTests.cs
示例11: Execute_should_create_collection
public void Execute_should_create_collection(
[Values(false, true)]
bool async)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
using (var binding = CoreTestConfiguration.GetReadWriteBinding())
{
var result = ExecuteOperation(subject, binding, async);
result["ok"].ToBoolean().Should().BeTrue();
var stats = GetCollectionStats(binding, async);
stats["ns"].ToString().Should().Be(_collectionNamespace.FullName);
}
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:16,代码来源:CreateCollectionOperationTests.cs
示例12: CreateCommand_should_return_expected_result_when_UsePowerOf2Sizes_is_set
public void CreateCommand_should_return_expected_result_when_UsePowerOf2Sizes_is_set(
[Values(false, true)]
bool usePowerOf2Sizes)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings)
{
UsePowerOf2Sizes = usePowerOf2Sizes
};
var expectedResult = new BsonDocument
{
{ "create", _collectionNamespace.CollectionName },
{ "flags", usePowerOf2Sizes ? 1 : 0 }
};
var result = subject.CreateCommand();
result.Should().Be(expectedResult);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:18,代码来源:CreateCollectionOperationTests.cs
示例13: CreateCommand_should_return_expected_result_when_ValidationLevel_is_set
public void CreateCommand_should_return_expected_result_when_ValidationLevel_is_set(
[Values(DocumentValidationLevel.Moderate, DocumentValidationLevel.Off)]
DocumentValidationLevel value)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings)
{
ValidationLevel = value
};
var expectedResult = new BsonDocument
{
{ "create", _collectionNamespace.CollectionName },
{ "validationLevel", value.ToString().ToLowerInvariant() }
};
var result = subject.CreateCommand();
result.Should().Be(expectedResult);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:18,代码来源:CreateCollectionOperationTests.cs
示例14: CreateCommand_should_return_expected_result_when_StorageEngine_is_set
public void CreateCommand_should_return_expected_result_when_StorageEngine_is_set(
[Values(null, "{ awesome: true }")]
string storageEngine)
{
var storageEngineDoc = storageEngine == null ? null : BsonDocument.Parse(storageEngine);
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings)
{
StorageEngine = storageEngineDoc
};
var expectedResult = new BsonDocument
{
{ "create", _collectionNamespace.CollectionName },
{ "storageEngine", storageEngineDoc, storageEngine != null }
};
var result = subject.CreateCommand();
result.Should().Be(expectedResult);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:19,代码来源:CreateCollectionOperationTests.cs
示例15: CreateCommand_should_return_expected_result_when_MaxSize_is_set
public void CreateCommand_should_return_expected_result_when_MaxSize_is_set(
[Values(1, 2)]
long maxSize)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings)
{
MaxSize = maxSize
};
var expectedResult = new BsonDocument
{
{ "create", _collectionNamespace.CollectionName },
{ "size", maxSize }
};
var result = subject.CreateCommand();
result.Should().Be(expectedResult);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:18,代码来源:CreateCollectionOperationTests.cs
示例16: CreateCommand_should_return_expected_result_when_IndexOptionDefaults_is_set
public void CreateCommand_should_return_expected_result_when_IndexOptionDefaults_is_set()
{
var value = new BsonDocument("storageEngine", new BsonDocument("x", 1));
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings)
{
IndexOptionDefaults = value
};
var expectedResult = new BsonDocument
{
{ "create", _collectionNamespace.CollectionName },
{ "indexOptionDefaults", value }
};
var result = subject.CreateCommand();
result.Should().Be(expectedResult);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:17,代码来源:CreateCollectionOperationTests.cs
示例17: IndexOptionDefaults_should_work
public void IndexOptionDefaults_should_work()
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
var value = new BsonDocument("storageEngine", new BsonDocument("x", 1));
subject.IndexOptionDefaults.Should().BeNull();
subject.IndexOptionDefaults = value;
subject.IndexOptionDefaults.Should().Be(value);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:10,代码来源:CreateCollectionOperationTests.cs
示例18: UsePowerOf2Sizes_should_work
public void UsePowerOf2Sizes_should_work()
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
subject.UsePowerOf2Sizes.Should().NotHaveValue();
subject.UsePowerOf2Sizes = true;
subject.UsePowerOf2Sizes.Should().BeTrue();
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:9,代码来源:CreateCollectionOperationTests.cs
示例19: MaxSize_should_work
public void MaxSize_should_work()
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
subject.MaxSize.Should().NotHaveValue();
subject.MaxSize = 1;
subject.MaxSize.Should().Be(1);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:9,代码来源:CreateCollectionOperationTests.cs
示例20: ValidationLevel_should_work
public void ValidationLevel_should_work(
[Values(null, DocumentValidationLevel.Moderate, DocumentValidationLevel.Off)]
DocumentValidationLevel? value)
{
var subject = new CreateCollectionOperation(_collectionNamespace, _messageEncoderSettings);
subject.ValidationLevel.Should().BeNull();
subject.ValidationLevel = value;
subject.ValidationLevel.Should().Be(value);
}
开发者ID:narutoswj,项目名称:mongo-csharp-driver,代码行数:11,代码来源:CreateCollectionOperationTests.cs
注:本文中的CreateCollectionOperation类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论