Skip to content

Commit e68945e

Browse files
muhammad-othmanashovlin
authored andcommitted
Add TestConvertingListContainsEmptyMapToJson to dynamodb tests
1 parent 4546500 commit e68945e

File tree

1 file changed

+28
-0
lines changed

1 file changed

+28
-0
lines changed

sdk/test/Services/DynamoDBv2/UnitTests/Custom/DynamoDBTests.cs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,34 @@ public void TestConvertingMapIfNullSet()
9292
Assert.AreEqual("testvalue", dynamoDocument["testmap"].AsDocument()["test"].AsString());
9393
}
9494

95+
96+
[TestMethod]
97+
[TestCategory("DynamoDBv2")]
98+
public void TestConvertingListContainsEmptyMapToJson()
99+
{
100+
var initialAttributeMap = new Dictionary<string, AttributeValue>
101+
{
102+
{ "testlist", new AttributeValue
103+
{
104+
L = new List<AttributeValue>
105+
{
106+
new AttributeValue
107+
{
108+
M = new Dictionary<string, AttributeValue>(),
109+
}
110+
}
111+
}
112+
}
113+
};
114+
115+
var document = Document.FromAttributeMap(initialAttributeMap);
116+
var result = document.ToJson();
117+
118+
119+
Assert.IsNotNull(result);
120+
Assert.AreEqual(document["testlist"].AsListOfDocument().Count, 0);
121+
}
122+
95123
private static List<Type> GetSubTypes(Type baseType)
96124
{
97125
var assembly = baseType.Assembly;

0 commit comments

Comments
 (0)