Skip to content

Commit 26aaa63

Browse files
committed
Add more tests
1 parent 5ae2bc1 commit 26aaa63

4 files changed

Lines changed: 68 additions & 35 deletions

File tree

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
using Amazon.DynamoDBv2.Model;
2+
using DynamoDBGenerator.Attributes;
3+
using DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Marshaller.Asserters;
4+
using DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Marshaller.Generics.Sets.Asserters;
5+
6+
namespace DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Marshaller.Generics.Sets;
7+
8+
[DynamoDBMarshaller(EntityType = typeof(Container<HashSet<decimal>>))]
9+
public partial class DecimalHashSetTests : SetAsserter<HashSet<decimal>, decimal>
10+
{
11+
public DecimalHashSetTests() : base([2032m, 0.323232932m, 0.9329392m], x => new HashSet<decimal>(x))
12+
{
13+
}
14+
15+
protected override Dictionary<string, AttributeValue> MarshallImplementation(Container<HashSet<decimal>> element)
16+
{
17+
return ContainerMarshaller.Marshall(element);
18+
}
19+
20+
protected override Container<HashSet<decimal>> UnmarshallImplementation(
21+
Dictionary<string, AttributeValue> attributeValues)
22+
{
23+
return ContainerMarshaller.Unmarshall(attributeValues);
24+
}
25+
}

tests/DynamoDBGenerator.SourceGenerator.Tests/DynamoDBDocumentTests/Marshaller/Generics/Sets/IntHashSetTests.cs

Lines changed: 0 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -18,39 +18,4 @@ protected override Container<HashSet<int>> UnmarshallImplementation(
1818
{
1919
return ContainerMarshaller.Unmarshall(attributeValues);
2020
}
21-
}
22-
23-
// TODO Support
24-
//[DynamoDBMarshaller(EntityType = typeof(Container<HashSet<int?>>))]
25-
//public partial class NUllableIntHashSetTests() : SetAsserter<HashSet<int?>, int?>([2, 3, 4, 5], x => new HashSet<int?>(x))
26-
//{
27-
// protected override Container<HashSet<int?>> UnmarshallImplementation(
28-
// Dictionary<string, AttributeValue> attributeValues)
29-
// {
30-
// return ContainerMarshaller.Unmarshall(attributeValues);
31-
// }
32-
//
33-
// protected override Dictionary<string, AttributeValue> MarshallImplementation(Container<HashSet<int?>> element)
34-
// {
35-
// return ContainerMarshaller.Marshall(element);
36-
// }
37-
//}
38-
39-
[DynamoDBMarshaller(EntityType = typeof(Container<HashSet<decimal>>))]
40-
public partial class DecimalHashSetTests : SetAsserter<HashSet<decimal>, decimal>
41-
{
42-
public DecimalHashSetTests() : base(new[] { 2032m, 0.323232932m, 0.9329392m }, x => new HashSet<decimal>(x))
43-
{
44-
}
45-
46-
protected override Dictionary<string, AttributeValue> MarshallImplementation(Container<HashSet<decimal>> element)
47-
{
48-
return ContainerMarshaller.Marshall(element);
49-
}
50-
51-
protected override Container<HashSet<decimal>> UnmarshallImplementation(
52-
Dictionary<string, AttributeValue> attributeValues)
53-
{
54-
return ContainerMarshaller.Unmarshall(attributeValues);
55-
}
5621
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
using Amazon.DynamoDBv2.Model;
2+
using DynamoDBGenerator.Attributes;
3+
using DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Marshaller.Asserters;
4+
using DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Marshaller.Generics.Sets.Asserters;
5+
6+
namespace DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Marshaller.Generics.Sets;
7+
8+
[DynamoDBMarshaller(EntityType = typeof(Container<HashSet<decimal?>>))]
9+
public partial class NullableDecimalHashSetTests() : SetAsserter<HashSet<decimal?>, decimal?>([2032m, 0.323232932m, 0.9329392m, null], x => new HashSet<decimal?>(x))
10+
{
11+
protected override Container<HashSet<decimal?>> UnmarshallImplementation(
12+
Dictionary<string, AttributeValue> attributeValues)
13+
{
14+
return ContainerMarshaller.Unmarshall(attributeValues);
15+
}
16+
17+
protected override Dictionary<string, AttributeValue> MarshallImplementation(Container<HashSet<decimal?>> element)
18+
{
19+
return ContainerMarshaller.Marshall(element);
20+
}
21+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using Amazon.DynamoDBv2.Model;
2+
using DynamoDBGenerator.Attributes;
3+
using DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Marshaller.Asserters;
4+
using DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Marshaller.Generics.Sets.Asserters;
5+
6+
namespace DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Marshaller.Generics.Sets;
7+
8+
[DynamoDBMarshaller(EntityType = typeof(Container<HashSet<int?>>))]
9+
public partial class NullableIntHashSetTests()
10+
: SetAsserter<HashSet<int?>, int?>([2, 3, null, 4, 5], x => new HashSet<int?>(x))
11+
{
12+
protected override Container<HashSet<int?>> UnmarshallImplementation(
13+
Dictionary<string, AttributeValue> attributeValues)
14+
{
15+
return ContainerMarshaller.Unmarshall(attributeValues);
16+
}
17+
18+
protected override Dictionary<string, AttributeValue> MarshallImplementation(Container<HashSet<int?>> element)
19+
{
20+
return ContainerMarshaller.Marshall(element);
21+
}
22+
}

0 commit comments

Comments
 (0)