예제 #1
0
            public void NewInfoObject()
            {
                //------------ Act
                var info = new ProjectionInfo(ProjectionTestsHelper.GetViewInfos(1), ProjectionTestsHelper.GetProjection(1), new DocumentStrategy());

                //------------ Assert
                info.GetEventStreamVersion().Should().Be(0);
            }
예제 #2
0
        private static ProjectionHash CreateHash(params int[] viewNumbers)
        {
            Condition.Requires(viewNumbers, "viewNumbers").IsNotEmpty();
            var viewTypes  = ProjectionTestsHelper.GetViews(viewNumbers);
            var projection = ProjectionTestsHelper.GetProjection(viewNumbers[0]);

            return(new ProjectionHash(projection.GetType(), viewTypes, typeof(DocumentStrategy)));
        }
예제 #3
0
            private ExpectedProjectionVersion(int projectionNumber, long expectedEventVersion)
            {
                var projection = ProjectionTestsHelper.GetProjection(projectionNumber);

                this.ProjectionType       = projection.GetType();
                this.CheckpointFile       = this.ProjectionType.Name;
                this.ExpectedEventVersion = expectedEventVersion;
            }
예제 #4
0
            public void LoadedInfo()
            {
                //------------ Arrange
                this.MockSaveCheckpoint();
                this.MockLoadCheckpoint();

                var originalInfo = new ProjectionInfo(ProjectionTestsHelper.GetViewInfos(1), ProjectionTestsHelper.GetProjection(1), new DocumentStrategy());

                originalInfo.Initialize(this._storage);
                const int checkpoint = 1521516;

                originalInfo.UpdateEventStreamVersion(checkpoint).Wait();

                //------------ Act
                var info = this.ReloadProjectionInfo(originalInfo);

                //------------ Assert
                info.GetEventStreamVersion().Should().Be(checkpoint);
            }
예제 #5
0
        public void ProjectionHashChanges_ProjectionRebuilt()
        {
            //------------ Arrange
            var loadedProjections    = LoadInfoList(2);
            var generatedProjections = new List <ProjectionInfo> {
                new ProjectionInfo(ProjectionTestsHelper.GetViewInfos(2), new DifferentHash.ProjectionMock2(null), new DocumentStrategy())
            };

            //------------ Act
            var projectionsPartition = PartitionedProjectionsInfo.Partition(loadedProjections, generatedProjections, this._storage);

            //------------ Assert
            var expectedGeneratedProjections = new List <ProjectionInfo> {
                new ProjectionInfo(ProjectionTestsHelper.GetViewInfos(2), new DifferentHash.ProjectionMock2(null), new DocumentStrategy())
            };

            projectionsPartition.ReadyForUse.Should().BeEmpty();
            projectionsPartition.NeedRebuild.Should().Equal(expectedGeneratedProjections);
            projectionsPartition.Obsolete.Should().BeEmpty();
            AssertProjectionInfosInitialized(projectionsPartition);
        }
예제 #6
0
 private static ProjectionInfo CreateInfo(int i)
 {
     return(new ProjectionInfo(ProjectionTestsHelper.GetViewInfos(i), ProjectionTestsHelper.GetProjection(i), new DocumentStrategy()));
 }
예제 #7
0
 private ProjectionsRebuilder <TestEvent> CreateRebuilder(params int[] projectionNumbers)
 {
     return(new ProjectionsRebuilder <TestEvent>("test", this._documentStorage, this._eventStore, s =>
                                                 ProjectionTestsHelper.GetProjections(s, projectionNumbers)));
 }