コード例 #1
0
        public async Task TakeSnapshot_sets_blob_properties_correctly_if_snapshot_blob_not_exists(
            Guid streamId, State state, IStateRehydrator <State> rehydrator)
        {
            // Arrange
            Mock.Get(rehydrator)
            .Setup(x => x.TryRehydrateState(streamId))
            .ReturnsAsync(state);

            BlobSnapshotter <State> sut = GenerateSut(rehydrator);

            // Act
            await sut.TakeSnapshot(streamId);

            // Assert
            ICloudBlob blob = await GetBlob(streamId);

            blob.Properties.ContentType.Should().Be("application/json");
            blob.Properties.ContentEncoding.Should().BeEquivalentTo("UTF-8");
        }
コード例 #2
0
        public async Task TaksSnapshot_creates_new_snapshot_blob_if_not_exists(
            Guid streamId, State state, IStateRehydrator <State> rehydrator)
        {
            // Arrange
            Mock.Get(rehydrator)
            .Setup(x => x.TryRehydrateState(streamId))
            .ReturnsAsync(state);

            BlobSnapshotter <State> sut = GenerateSut(rehydrator);

            // Act
            await sut.TakeSnapshot(streamId);

            // Assert
            ICloudBlob blob = await GetBlob(streamId);

            string content = await DownloadContent(blob);

            State snapshot = JsonConvert.DeserializeObject <State>(content);

            snapshot.Should().BeEquivalentTo(state);
        }