public async Task DeleteSnapshotsShouldRemoveSnapshots() { var options = new DynamoDBProviderOptions("proto_actor_events", "proto_actor_snapshots"); var provider = new DynamoDBProvider(_client, options); var actorName = GetRandomActorName(); await provider.PersistSnapshotAsync(actorName, 1, new SomeSnapshot { Something = "asdf2", Something2 = 2 }); await provider.PersistSnapshotAsync(actorName, 2, new SomeSnapshot { Something = "asdf3", Something2 = 3 }); var retreived = new List <object>(); var res = await provider.GetSnapshotAsync(actorName); Assert.Equal(2, res.Index); Assert.NotNull(res.Snapshot); await provider.DeleteSnapshotsAsync(actorName, 1); res = await provider.GetSnapshotAsync(actorName); Assert.Equal(2, res.Index); Assert.NotNull(res.Snapshot); await provider.DeleteSnapshotsAsync(actorName, 2); res = await provider.GetSnapshotAsync(actorName); Assert.Equal(0, res.Index); Assert.Null(res.Snapshot); }
public async Task PersistSnapshotShouldGoThru() { var options = new DynamoDBProviderOptions("proto_actor_events", "proto_actor_snapshots"); var provider = new DynamoDBProvider(_client, options); var actorName = GetRandomActorName(); await provider.PersistSnapshotAsync(actorName, 1, new SomeSnapshot { Something = "asdf", Something2 = 1 }); }
public async Task GetSnapshotShouldReturnLastSnapshot() { var options = new DynamoDBProviderOptions("proto_actor_events", "proto_actor_snapshots"); var provider = new DynamoDBProvider(_client, options); var actorName = GetRandomActorName(); await provider.PersistSnapshotAsync(actorName, 1, new SomeSnapshot { Something = "asdf2", Something2 = 2 }); await provider.PersistSnapshotAsync(actorName, 2, new SomeSnapshot { Something = "asdf3", Something2 = 3 }); var res = await provider.GetSnapshotAsync(actorName); Assert.Equal(2, res.Index); var snapshot = res.Snapshot as SomeSnapshot; Assert.NotNull(snapshot); Assert.Equal("asdf3", snapshot.Something); Assert.Equal(3, snapshot.Something2); }