fix ISaveProgressionTask

This commit is contained in:
Vincent Cloutier 2023-04-23 14:18:00 -04:00
parent 7ce2453ceb
commit ad79d183b4
4 changed files with 2 additions and 29 deletions

View file

@ -1,11 +0,0 @@
using System.Threading;
using System.Threading.Tasks;
using BirdsiteLive.Pipeline.Models;
namespace BirdsiteLive.Pipeline.Contracts
{
public interface ISaveProgressionTask
{
Task ProcessAsync(UserWithDataToSync userWithTweetsToSync, CancellationToken ct);
}
}

View file

@ -21,16 +21,14 @@ namespace BirdsiteLive.Pipeline
private readonly IRetrieveTweetsProcessor _retrieveTweetsProcessor;
private readonly IRetrieveFollowersProcessor _retrieveFollowersProcessor;
private readonly ISendTweetsToFollowersProcessor _sendTweetsToFollowersProcessor;
private readonly ISaveProgressionTask _saveProgressionTask;
private readonly ILogger<StatusPublicationPipeline> _logger;
#region Ctor
public StatusPublicationPipeline(IRetrieveTweetsProcessor retrieveTweetsProcessor, IRetrieveTwitterUsersProcessor retrieveTwitterAccountsProcessor, IRetrieveFollowersProcessor retrieveFollowersProcessor, ISendTweetsToFollowersProcessor sendTweetsToFollowersProcessor, ISaveProgressionTask saveProgressionTask, ILogger<StatusPublicationPipeline> logger)
public StatusPublicationPipeline(IRetrieveTweetsProcessor retrieveTweetsProcessor, IRetrieveTwitterUsersProcessor retrieveTwitterAccountsProcessor, IRetrieveFollowersProcessor retrieveFollowersProcessor, ISendTweetsToFollowersProcessor sendTweetsToFollowersProcessor, ILogger<StatusPublicationPipeline> logger)
{
_retrieveTweetsProcessor = retrieveTweetsProcessor;
_retrieveFollowersProcessor = retrieveFollowersProcessor;
_sendTweetsToFollowersProcessor = sendTweetsToFollowersProcessor;
_saveProgressionTask = saveProgressionTask;
_retrieveTwitterAccountsProcessor = retrieveTwitterAccountsProcessor;
_logger = logger;

View file

@ -77,7 +77,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
var followersDalMock = new Mock<IFollowersDal>(MockBehavior.Strict);
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
@ -165,7 +164,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
ParallelFediversePosts = 1
};
var saveProgressMock = new Mock<ISaveProgressionTask>();
var removeFollowerMock = new Mock<IRemoveFollowerAction>(MockBehavior.Strict);
#endregion
@ -250,7 +248,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
.Returns(Task.CompletedTask);
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
@ -343,7 +340,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
ParallelFediversePosts = 1
@ -440,7 +436,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
ParallelFediversePosts = 1
@ -519,7 +514,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
var followersDalMock = new Mock<IFollowersDal>(MockBehavior.Strict);
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
@ -600,7 +594,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
var followersDalMock = new Mock<IFollowersDal>(MockBehavior.Strict);
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
@ -689,7 +682,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
.Returns(Task.CompletedTask);
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
@ -775,7 +767,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
var followersDalMock = new Mock<IFollowersDal>(MockBehavior.Strict);
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
@ -865,7 +856,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
var followersDalMock = new Mock<IFollowersDal>(MockBehavior.Strict);
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
@ -959,7 +949,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
.Returns(Task.CompletedTask);
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{
@ -1054,7 +1043,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
.Returns(Task.CompletedTask);
var loggerMock = new Mock<ILogger<SendTweetsToFollowersProcessor>>();
var saveProgressMock = new Mock<ISaveProgressionTask>();
var settings = new InstanceSettings
{

View file

@ -30,18 +30,16 @@ namespace BirdsiteLive.Pipeline.Tests
var retrieveTweetsProcessor = new Mock<IRetrieveTweetsProcessor>(MockBehavior.Strict);
var retrieveFollowersProcessor = new Mock<IRetrieveFollowersProcessor>(MockBehavior.Strict);
var sendTweetsToFollowersProcessor = new Mock<ISendTweetsToFollowersProcessor>(MockBehavior.Strict);
var saveProgressionProcessor = new Mock<ISaveProgressionTask>(MockBehavior.Strict);
var logger = new Mock<ILogger<StatusPublicationPipeline>>();
#endregion
var pipeline = new StatusPublicationPipeline(retrieveTweetsProcessor.Object, retrieveTwitterUserProcessor.Object, retrieveFollowersProcessor.Object, sendTweetsToFollowersProcessor.Object, saveProgressionProcessor.Object, logger.Object);
var pipeline = new StatusPublicationPipeline(retrieveTweetsProcessor.Object, retrieveTwitterUserProcessor.Object, retrieveFollowersProcessor.Object, sendTweetsToFollowersProcessor.Object, logger.Object);
await pipeline.ExecuteAsync(ct.Token);
#region Validations
retrieveTweetsProcessor.VerifyAll();
retrieveFollowersProcessor.VerifyAll();
sendTweetsToFollowersProcessor.VerifyAll();
saveProgressionProcessor.VerifyAll();
logger.VerifyAll();
#endregion
}