public void TestCanSendCommandToSecondary(string command, bool expectedResult) { var doc = new BsonDocument(command, 1); var result = CanCommandBeSentToSecondary.DefaultImplementation(doc); Assert.AreEqual(expectedResult, result); }
public void TestCannotSendNonInlineMapReduceToSecondary() { var doc = new BsonDocument { { "mapreduce", "col" }, { "map", "emit()" }, { "reduce", "return 1" } }; var result = CanCommandBeSentToSecondary.DefaultImplementation(doc); Assert.IsFalse(result); }
public void TestCanSendInlineMapReduceToSecondary() { var doc = new BsonDocument { { "mapreduce", "col" }, { "map", "emit()" }, { "reduce", "return 1" }, { "out", new BsonDocument("inline", 1) } }; var result = CanCommandBeSentToSecondary.DefaultImplementation(doc); Assert.IsTrue(result); }
public void TestCanSendAggregateWithReadOnlyPipelineToSecondary() { var pipeline = new BsonArray { new BsonDocument { { "$match", new BsonDocument("x", 1) } } }; var command = new BsonDocument { { "aggregate", "collection" }, { "pipeline", pipeline } }; var result = CanCommandBeSentToSecondary.DefaultImplementation(command); Assert.IsTrue(result); }