Skip to content

Commit

Permalink
additional unit test
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelstonis committed Oct 23, 2021
1 parent 908d96c commit 47896bd
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions Tycho.UnitTests/TychoDbTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -856,6 +856,36 @@ public async Task TychoDb_InsertBlobAndDelete_ShouldBeSuccessful(IJsonSerializer
deleteResult.Should().BeTrue();
}

[DataTestMethod]
[DynamicData(nameof(JsonSerializers))]
public async Task TychoDb_InsertManyBlobsAndDeleteManyBlobs_ShouldBeSuccessful(IJsonSerializer jsonSerializer)
{
using var db =
BuildDatabaseConnection(jsonSerializer)
.Connect();

var expected = 5;

var textExample = "This is a test message";
var partition = "partition";

for (int i = 0; i < expected; i++)
{
using var stream = new MemoryStream();
using var writer = new StreamWriter(stream);
writer.Write(textExample);
writer.Flush();
stream.Position = 0;

await db.WriteBlobAsync(stream, i.ToString(), partition);
}

var deleteResult = await db.DeleteBlobsAsync(partition);

deleteResult.Successful.Should().BeTrue();
deleteResult.Count.Should().Be(expected);
}

public static TychoDb BuildDatabaseConnection(IJsonSerializer jsonSerializer)
{
#if ENCRYPTED
Expand Down

0 comments on commit 47896bd

Please sign in to comment.