public void GeneratedProjectionEmpty() { //------------ Arrange var loadedProjections = LoadInfoList(1, 2); var generatedProjections = Enumerable.Empty <ProjectionInfo>(); //------------ Act var projectionsPartition = PartitionedProjectionsInfo.Partition(loadedProjections, generatedProjections, this._storage); //------------ Assert projectionsPartition.ReadyForUse.Should().BeEmpty(); projectionsPartition.NeedRebuild.Should().BeEmpty(); projectionsPartition.Obsolete.Should().Equal(GenerateInfoList(1, 2)); AssertProjectionInfosInitialized(projectionsPartition); }
public void ProjectionsIntersect() { //------------ Arrange var loadedProjections = LoadInfoList(1, 2, 6, 7); var generatedProjections = GenerateInfoList(7, 6, 3, 4); //------------ Act var projectionsPartition = PartitionedProjectionsInfo.Partition(loadedProjections, generatedProjections, this._storage); //------------ Assert projectionsPartition.ReadyForUse.Should().BeEquivalentTo(GenerateInfoList(6, 7)); projectionsPartition.NeedRebuild.Should().Equal(GenerateInfoList(3, 4)); projectionsPartition.Obsolete.Should().Equal(GenerateInfoList(1, 2)); AssertProjectionInfosInitialized(projectionsPartition); }
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); }
public void ExceptionOnCheckpointLoad_GoesToRebuildAndInitialized() { //------------ Arrange var loadedProjections = LoadInfoList(1, 2, 5, 6, 7); var generatedProjections = GenerateInfoList(3, 4, 1, 2, 7); ProjectionCheckpoint checkpointOut; this._storeMock.GetReader <object, ProjectionCheckpoint>().TryGet(Arg.Is <string>(s => s.Contains("7")), out checkpointOut).Returns(arg => { throw new Exception("test"); }); //------------ Act var projectionsPartition = PartitionedProjectionsInfo.Partition(loadedProjections, generatedProjections, this._storage); //------------ Assert projectionsPartition.ReadyForUse.Should().Equal(GenerateInfoList(1, 2)); projectionsPartition.NeedRebuild.Should().Equal(GenerateInfoList(3, 4, 7)); projectionsPartition.Obsolete.Should().Equal(GenerateInfoList(5, 6)); AssertProjectionInfosInitialized(projectionsPartition); }