public async Task MapReduceAsync_with_collection_output_mode_should_execute_the_MapReduceOperation() { var filter = new BsonDocument("filter", 1); var scope = new BsonDocument("test", 3); var sort = new BsonDocument("sort", 1); var options = new MapReduceOptions <BsonDocument> { Filter = new BsonDocument("filter", 1), Finalize = "finalizer", JavaScriptMode = true, Limit = 10, MaxTime = TimeSpan.FromMinutes(2), OutputOptions = MapReduceOutputOptions.Replace("awesome", "otherDB", true), Scope = scope, Sort = sort, Verbose = true }; var result = await _subject.MapReduceAsync("map", "reduce", options); var call = _operationExecutor.GetWriteCall <BsonDocument>(); call.Operation.Should().BeOfType <MapReduceOutputToCollectionOperation>(); var operation = (MapReduceOutputToCollectionOperation)call.Operation; operation.CollectionNamespace.FullName.Should().Be("foo.bar"); operation.Filter.Should().Be(filter); operation.FinalizeFunction.Should().Be(options.Finalize); operation.JavaScriptMode.Should().Be(options.JavaScriptMode); operation.Limit.Should().Be(options.Limit); operation.MapFunction.Should().Be(new BsonJavaScript("map")); operation.MaxTime.Should().Be(options.MaxTime); operation.NonAtomicOutput.Should().NotHaveValue(); operation.OutputCollectionNamespace.Should().Be(CollectionNamespace.FromFullName("otherDB.awesome")); operation.OutputMode.Should().Be(Core.Operations.MapReduceOutputMode.Replace); operation.ReduceFunction.Should().Be(new BsonJavaScript("reduce")); operation.Scope.Should().Be(scope); operation.ShardedOutput.Should().Be(true); operation.Sort.Should().Be(sort); operation.Verbose.Should().Be(options.Verbose); }
public void FromFullName_should_throw_an_argument_null_exception_if_full_name_is_null() { Action act = () => CollectionNamespace.FromFullName(null); act.ShouldThrow <ArgumentNullException>(); }
public void ToString_should_return_the_name() { var subject = CollectionNamespace.FromFullName("test.foo"); subject.ToString().Should().Be("test.foo"); }