public void WhenGet_ThenReturnsDto()
        {
            var dto = new TestDtoWithId {
                Id = "anid"
            };

            this.repository.Setup(repo =>
                                  repo.Retrieve(It.IsAny <string>(), It.IsAny <string>(), It.IsAny <RepositoryEntityMetadata>()))
            .Returns(CommandEntity.FromType(dto));

            var result = this.storage.Get <TestDtoWithId>(Identifier.Create("anid"));

            result.Id.Should().Be("anid");
        }
        public void SaveCheckpoint(string streamName, long position)
        {
            var checkpoint = GetCheckpoint(streamName);

            if (checkpoint == null)
            {
                checkpoint = new Checkpoint
                {
                    Position   = position,
                    StreamName = streamName
                };
                checkpoint.Id = this.idFactory.Create(checkpoint);
                this.repository.Add(ContainerName, CommandEntity.FromType(checkpoint));
            }
            else
            {
                checkpoint.Position = position;
                this.repository.Replace(ContainerName, checkpoint.Id, CommandEntity.FromType(checkpoint));
            }

            this.recorder.TraceDebug("Saved checkpoint {StreamName} to position: {Position}", streamName,
                                     position);
        }