PageRenderTime 63ms CodeModel.GetById 24ms RepoModel.GetById 1ms app.codeStats 0ms

/Extensions/src/Ncqrs.Eventing.Storage.RavenDB.Tests/RavenDBSnapshotStoreTests.cs

http://github.com/ncqrs/ncqrs
C# | 34 lines | 29 code | 5 blank | 0 comment | 0 complexity | 754704f1945b25a693250cfe7782e097 MD5 | raw file
Possible License(s): MPL-2.0-no-copyleft-exception, Apache-2.0
  1. using System;
  2. using FluentAssertions;
  3. using Ncqrs.Eventing.Sourcing.Snapshotting;
  4. using NUnit.Framework;
  5. namespace Ncqrs.Eventing.Storage.RavenDB.Tests
  6. {
  7. [TestFixture]
  8. public class RavenDBSnapshotStoreTests : RavenDBTestBase
  9. {
  10. [Serializable]
  11. public class MySnapshot
  12. {
  13. public string Value { get; set; }
  14. }
  15. [Test]
  16. public void Saving_snapshot_should_not_throw_an_exception_when_snapshot_is_valid()
  17. {
  18. var targetStore = new RavenDBSnapshotStore(_documentStore);
  19. var anId = Guid.NewGuid();
  20. var aVersion = 12;
  21. var snapshot = new Snapshot(anId, aVersion, new MySnapshot {Value = "Some value"});
  22. targetStore.SaveSnapshot(snapshot);
  23. var savedSnapshot = targetStore.GetSnapshot(anId, long.MaxValue);
  24. savedSnapshot.EventSourceId.Should().Be(anId);
  25. savedSnapshot.Version.Should().Be(aVersion);
  26. ((MySnapshot) savedSnapshot.Payload).Value.Should().Be("Some value");
  27. }
  28. }
  29. }