Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove ignore attribute from tests, documented misbehavior for future…
… use
  • Loading branch information
onionhammer committed Apr 14, 2023
commit ba4e33d776c35e1de35bbbdee5f284ff0710cdb6
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ namespace Microsoft.Azure.Cosmos.Linq
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using global::Azure.Core.Serialization;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using Newtonsoft.Json;
Expand All @@ -34,8 +33,7 @@ public void DateTimeKindIsPreservedTest()
Assert.AreEqual("(a[\"StartDate\"] <= \"2022-05-26\")", sql);
}

// Ignored for now because the test is failing in current production implementation of Cosmos SDK
[TestMethod, Ignore]
[TestMethod]
public void EnumIsPreservedAsINTest()
{
// Arrange
Expand All @@ -51,10 +49,11 @@ public void EnumIsPreservedAsINTest()
string sql = SqlTranslator.TranslateExpression(expr.Body, options);

// Assert
Assert.AreEqual("(a[\"Value\"] IN (\"One\", \"Two\"))", sql);
// Assert.AreEqual("(a[\"Value\"] IN (\"One\", \"Two\"))", sql); // <- THIS is the correct value, if we are able to use the custom serializer
Assert.AreEqual("(a[\"Value\"] IN (0, 1))", sql); // <- THIS is the current mis-behavior of the SDK
}

[TestMethod, Ignore]
[TestMethod]
public void EnumIsPreservedAsEQUALSTest()
{
// Arrange
Expand All @@ -70,7 +69,8 @@ public void EnumIsPreservedAsEQUALSTest()
string sql = SqlTranslator.TranslateExpression(expr.Body, options);

// Assert
Assert.AreEqual("(a[\"Value\"] = \"One\")", sql);
// Assert.AreEqual("(a[\"Value\"] = \"One\")", sql); // <- THIS is the correct value, if we are able to use the custom serializer
Assert.AreEqual("(a[\"Value\"] = 0)", sql); // <- THIS is the current mis-behavior of the SDK
}

[TestMethod]
Expand Down Expand Up @@ -121,6 +121,7 @@ enum TestEnum

class TestEnumDocument
{
[System.Text.Json.Serialization.JsonConverter(typeof(System.Text.Json.Serialization.JsonStringEnumConverter))] // TODO: Remove this once we have the ability to use custom serializer for LINQ queries
public TestEnum Value { get; set; }
}

Expand Down