public async Task When_starting_a_projection_by_name_then_the_user_desired_state_is_updated() { var projectionNameString = "projection-name"; var projections = new RegisteredProjectionsBuilder(_fixture, _registeredProjections) .AddNamedProjection(projectionNameString) .Build(); await _sut.Start(projectionNameString, CancellationToken.None); projections.First().Projection.Verify(x => x.UpdateUserDesiredState(UserDesiredState.Started, It.IsAny <CancellationToken>())); }
public async Task When_starting_a_projection_by_id_then_the_user_desired_state_is_updated() { const string projectionId = "projection-id"; var projections = new RegisteredProjectionsBuilder(_fixture, _registeredProjections) .AddProjectionWithId(projectionId) .Build(); await _sut.Start(projectionId, CancellationToken.None); projections.First().Projection.Verify(x => x.UpdateUserDesiredState(UserDesiredState.Started, It.IsAny <CancellationToken>())); }
public async Task When_resuming_the_projections_then_no_user_desired_state_is_updated() { var projections = new RegisteredProjectionsBuilder(_fixture, _registeredProjections) .AddRandomProjections() .Build(); await _sut.Resume(CancellationToken.None); projections.ForEach(projectionMock => projectionMock.Projection.Verify( projection => projection.UpdateUserDesiredState(It.IsAny <UserDesiredState>(), It.IsAny <CancellationToken>()), Times.Never)); }
public async Task When_stopping_an_unknown_projection_by_name_then_no_user_desired_state_is_updated() { var projections = new RegisteredProjectionsBuilder(_fixture, _registeredProjections) .AddRandomProjections() .Build(); await _sut.Stop("unknown-projection", CancellationToken.None); projections.ForEach(projectionMock => projectionMock.Projection.Verify( projection => projection.UpdateUserDesiredState(UserDesiredState.Stopped, It.IsAny <CancellationToken>()), Times.Never)); }
public async Task When_starting_the_projections_then_all_user_desired_states_is_updated() { var projections = new RegisteredProjectionsBuilder(_fixture, _registeredProjections) .AddRandomProjections() .Build(); await _sut.Start(CancellationToken.None); projections.ForEach(projectionMock => projectionMock.Projection.Verify( projection => projection.UpdateUserDesiredState(UserDesiredState.Started, It.IsAny <CancellationToken>()), Times.Once)); }