Skip to content

Commit 65a56a4

Browse files
committed
Added a new test to deserialize a Set Attribute of complex Set Attribute
1 parent 18cee97 commit 65a56a4

File tree

2 files changed

+52
-466
lines changed

2 files changed

+52
-466
lines changed

commercetools.Sdk/Tests/commercetools.Sdk.Serialization.Tests/AttributeDeserializationTests.cs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -360,6 +360,23 @@ public void DeserializeProductWithSetOfSetAttribute()
360360
Assert.Equal("firstSet-1",firstSet.FirstOrDefault());
361361
Assert.Equal("secondSet-1",secondSet.FirstOrDefault());
362362
}
363+
[Fact]
364+
public void DeserializeProductWithSetOfSetOfSetAttribute()
365+
{
366+
var serializerService = this.serializationFixture.SerializerService;
367+
var productSerialized = File.ReadAllText("Resources/Attributes/SetOfSetAttribute.json");
368+
369+
var product = serializerService.Deserialize<Product>(productSerialized);
370+
var attr = product.MasterData.Current.MasterVariant.Attributes[1];
371+
Assert.NotNull(attr);
372+
Assert.True(attr.IsSetAttribute<AttributeSet<AttributeSet<string>>>());
373+
var setOfSetAttr = attr as Attribute<AttributeSet<AttributeSet<AttributeSet<string>>>>;
374+
Assert.NotNull(setOfSetAttr);
375+
var set111 = setOfSetAttr.Value.First().First();
376+
var set121 = setOfSetAttr.Value.ElementAt(1).First();
377+
Assert.Equal("set111-1",set111.FirstOrDefault());
378+
Assert.Equal("set121-1",set121.FirstOrDefault());
379+
}
363380

364381
}
365382
}

0 commit comments

Comments
 (0)