-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3486eb5
commit 41270be
Showing
5 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
...oDBGenerator.SourceGenerator.Tests/DynamoDBDocumentTests/Deserialize/Types/StreamTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System.Text; | ||
using Amazon.DynamoDBv2.Model; | ||
using DynamoDBGenerator.Attributes; | ||
namespace DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Deserialize.Types; | ||
|
||
[DynamoDBMarshaller(typeof(WithStream))] | ||
public partial class StreamTests | ||
{ | ||
|
||
[Fact] | ||
public void Unmarshall_Support_Stream() | ||
{ | ||
var subject = WithStreamMarshaller | ||
.Unmarshall(new Dictionary<string, AttributeValue> | ||
{ | ||
|
||
{ | ||
nameof(WithStream.MyMemoryStream), new AttributeValue | ||
{ | ||
B = new MemoryStream(Encoding.UTF8.GetBytes("Hello")) | ||
} | ||
} | ||
}) | ||
.Should() | ||
.BeOfType<WithStream>() | ||
.Subject; | ||
|
||
using var streamWriter = new StreamReader(subject.MyMemoryStream); | ||
|
||
streamWriter.ReadToEnd().Should().Be("Hello"); | ||
} | ||
} | ||
|
||
public class WithStream | ||
{ | ||
public MemoryStream MyMemoryStream { get; set; } | ||
} |
27 changes: 27 additions & 0 deletions
27
DynamoDBGenerator.SourceGenerator.Tests/DynamoDBDocumentTests/Serialize/Types/StreamTests.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Text; | ||
using Amazon.DynamoDBv2.Model; | ||
using DynamoDBGenerator.Attributes; | ||
namespace DynamoDBGenerator.SourceGenerator.Tests.DynamoDBDocumentTests.Serialize.Types; | ||
|
||
[DynamoDBMarshaller(typeof(WithStream))] | ||
public partial class StreamTests | ||
{ | ||
[Fact] | ||
public void Marshall_Support_Stream() | ||
{ | ||
var subject = WithStreamMarshaller | ||
.Marshall(new WithStream {MyMemoryStream = new MemoryStream(Encoding.UTF8.GetBytes("Hello"))}) | ||
.Should() | ||
.BeOfType<Dictionary<string, AttributeValue>>() | ||
.Subject; | ||
|
||
using var streamWriter = new StreamReader(subject[nameof(WithStream.MyMemoryStream)].B); | ||
streamWriter.ReadToEnd().Should().Be("Hello"); | ||
} | ||
|
||
} | ||
|
||
public class WithStream | ||
{ | ||
public MemoryStream MyMemoryStream { get; set; } | ||
Check warning on line 26 in DynamoDBGenerator.SourceGenerator.Tests/DynamoDBDocumentTests/Serialize/Types/StreamTests.cs GitHub Actions / build
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters