From 1012af66f2cf5569e837a37bacc499790e05cf84 Mon Sep 17 00:00:00 2001 From: Turnerj Date: Sun, 17 Nov 2019 01:11:46 +1030 Subject: [PATCH] Added external constants test --- .../Querying/ExpressionTranslationTests.cs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/MongoFramework.Tests/Infrastructure/Querying/ExpressionTranslationTests.cs b/tests/MongoFramework.Tests/Infrastructure/Querying/ExpressionTranslationTests.cs index 95f06c1e..dc46b02e 100644 --- a/tests/MongoFramework.Tests/Infrastructure/Querying/ExpressionTranslationTests.cs +++ b/tests/MongoFramework.Tests/Infrastructure/Querying/ExpressionTranslationTests.cs @@ -149,5 +149,19 @@ public void TranslateConditional_Not_OrElse() }; Assert.AreEqual(expected, result); } + + [TestMethod] + public void TranslateConditional_ExternalConstants() + { + var externalData = new BsonDocument { { "Data", "Hello World" } }; + + var expression = GetConditional(e => e.Id == externalData["Data"].AsString); + var result = ExpressionTranslation.TranslateConditional(expression); + var expected = new BsonDocument + { + { "Id", new BsonDocument { { "$eq", "Hello World" } } } + }; + Assert.AreEqual(expected, result); + } } }