PageRenderTime 47ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/Framework/src/Ncqrs.Tests/Eventing/Storage/NoDB/SnapshotStoreTests/when_getting_the_snapshot.cs

http://github.com/ncqrs/ncqrs
C# | 34 lines | 29 code | 5 blank | 0 comment | 0 complexity | 7a66faf79ce2414bfaf538457dff90e3 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, Apache-2.0
  1. using System;
  2. using Ncqrs.Eventing.Sourcing.Snapshotting;
  3. using FluentAssertions;
  4. using Xunit;
  5. namespace Ncqrs.Eventing.Storage.NoDB.Tests.SnapshotStoreTests
  6. {
  7. public class when_getting_the_snapshot : NoDBSnapshotStoreTestFixture
  8. {
  9. private Snapshot _retrieved;
  10. public when_getting_the_snapshot()
  11. {
  12. Snapshot = new Snapshot(Guid.NewGuid(), 1, new TestSnapshot { Name = "Name" });
  13. SnapshotStore.SaveSnapshot(Snapshot);
  14. _retrieved = SnapshotStore.GetSnapshot(Snapshot.EventSourceId, long.MaxValue);
  15. }
  16. [Fact]
  17. public void it_should_get_the_last_snapshot_saved()
  18. {
  19. _retrieved.EventSourceId.Should().Be(Snapshot.EventSourceId);
  20. _retrieved.Version.Should().Be(Snapshot.Version);
  21. }
  22. [Fact]
  23. public void it_should_return_null_if_the_snapshot_does_not_exist()
  24. {
  25. var shouldbenull = SnapshotStore.GetSnapshot(Guid.NewGuid(), long.MaxValue);
  26. Assert.Null(shouldbenull);
  27. }
  28. }
  29. }