Skip to content

Commit aeb4582

Browse files
muhammad-othmanashovlin
authored andcommitted
update TestJsonContainsEmptyMapToDocumentAndBackToJson&TestConvertingEmptyListToJson tests
1 parent 14ade31 commit aeb4582

File tree

1 file changed

+36
-37
lines changed

1 file changed

+36
-37
lines changed

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

Lines changed: 36 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ public void TestConvertingMapIfNullSet()
9494

9595
[TestMethod]
9696
[TestCategory("DynamoDBv2")]
97-
public void TestConvertingListContainsEmptyMapToJson()
97+
public void TestConvertingEmptyListToJson()
9898
{
9999
var initialAttributeMap = new Dictionary<string, AttributeValue>
100100
{
101-
{ "testlist", new AttributeValue
101+
{ "Lists", new AttributeValue
102102
{
103103
L = new List<AttributeValue>
104104
{
@@ -112,52 +112,51 @@ public void TestConvertingListContainsEmptyMapToJson()
112112
};
113113

114114
var document = Document.FromAttributeMap(initialAttributeMap);
115-
var result = document.ToJson();
116-
document = Document.FromAttributeMap(document.ToAttributeMap());
115+
Assert.AreEqual(document["Lists"].AsListOfDocument().Count, 0);
117116

118-
Assert.IsNotNull(document);
119-
Assert.IsNotNull(result);
120-
Assert.AreEqual(document["testlist"].AsListOfDocument().Count, 0);
117+
var jsonString = document.ToJson();
118+
Assert.IsNotNull(jsonString);
121119
}
122120

123121
[TestMethod]
122+
[TestCategory("DynamoDBv2")]
124123
[DataRow(@"{
125-
""Lists"": {
126-
""L"": [
127-
{
128-
""M"": {
129-
""SubLists"": {
130-
""L"": [
131-
{
132-
""M"": {}
133-
}
134-
]
135-
}
136-
}
137-
}
138-
]
139-
}
124+
""Lists"": {
125+
""L"": [
126+
{
127+
""M"": {
128+
""SubLists"": {
129+
""L"": [
130+
{
131+
""M"": {}
132+
}
133+
]
134+
}
135+
}
136+
}
137+
]
138+
}
140139
}")]
141140
[DataRow(@"{
142-
""Lists"": {
143-
""L"": [
144-
{
145-
""M"": {}
146-
}
147-
]
148-
}
141+
""Lists"": {
142+
""L"": [
143+
{
144+
""M"": {}
145+
}
146+
]
147+
}
149148
}")]
150-
[TestCategory("DynamoDBv2")]
151149
public void TestJsonContainsEmptyMapToDocumentAndBackToJson(string json)
152150
{
153-
var initialAttributeMap = Document.FromJson(json).ToAttributeMap();
154-
155-
var document = Document.FromAttributeMap(initialAttributeMap);
156-
var result = document.ToJson();
157-
document = Document.FromAttributeMap(document.ToAttributeMap());
151+
var initialDocument = Document.FromJson(json);
152+
Assert.IsNotNull(initialDocument);
153+
154+
var initialAttributeMap = initialDocument.ToAttributeMap();
155+
var convertedDocument = Document.FromAttributeMap(initialAttributeMap);
156+
Assert.IsNotNull(convertedDocument);
158157

159-
Assert.IsNotNull(document);
160-
Assert.IsNotNull(result);
158+
var jsonString = convertedDocument.ToJson();
159+
Assert.IsNotNull(jsonString);
161160
}
162161

163162
private static List<Type> GetSubTypes(Type baseType)

0 commit comments

Comments
 (0)