This commit is contained in:
Nicolas Constant 2022-02-07 19:37:28 -05:00
parent 420d8867e7
commit 9f9f88aab7
No known key found for this signature in database
GPG key ID: 1E9F677FB01A5688

View file

@ -289,10 +289,7 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
twitterUserServiceMock
.Setup(x => x.GetUser(It.Is<string>(y => y == acct2)))
.Throws(new Exception());
//twitterUserServiceMock
// .Setup(x => x.PurgeUser(It.Is<string>(y => y == acct2)));
var twitterUserDalMock = new Mock<ITwitterUserDal>(MockBehavior.Strict);
twitterUserDalMock
.Setup(x => x.GetTwitterUserAsync(It.Is<string>(y => y == acct2)))
@ -364,10 +361,7 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
twitterUserServiceMock
.Setup(x => x.GetUser(It.Is<string>(y => y == acct2)))
.Returns((TwitterUser)null);
//twitterUserServiceMock
// .Setup(x => x.PurgeUser(It.Is<string>(y => y == acct2)));
var twitterUserDalMock = new Mock<ITwitterUserDal>(MockBehavior.Strict);
twitterUserDalMock
.Setup(x => x.GetTwitterUserAsync(It.Is<string>(y => y == acct2)))
@ -439,10 +433,7 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
twitterUserServiceMock
.Setup(x => x.GetUser(It.Is<string>(y => y == acct2)))
.Returns((TwitterUser)null);
//twitterUserServiceMock
// .Setup(x => x.PurgeUser(It.Is<string>(y => y == acct2)));
var twitterUserDalMock = new Mock<ITwitterUserDal>(MockBehavior.Strict);
twitterUserDalMock
.Setup(x => x.GetTwitterUserAsync(It.Is<string>(y => y == acct2)))
@ -516,10 +507,7 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
{
Protected = true
});
//twitterUserServiceMock
// .Setup(x => x.PurgeUser(It.Is<string>(y => y == acct2)));
var twitterUserDalMock = new Mock<ITwitterUserDal>(MockBehavior.Strict);
twitterUserDalMock
.Setup(x => x.GetTwitterUserAsync(It.Is<string>(y => y == acct2)))
@ -594,10 +582,7 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
{
Protected = true
});
//twitterUserServiceMock
// .Setup(x => x.PurgeUser(It.Is<string>(y => y == acct2)));
var twitterUserDalMock = new Mock<ITwitterUserDal>(MockBehavior.Strict);
twitterUserDalMock
.Setup(x => x.GetTwitterUserAsync(It.Is<string>(y => y == acct2)))
@ -625,70 +610,7 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
removeTwitterAccountActionMock.VerifyAll();
#endregion
}
//[TestMethod]
//public async Task ProcessAsync_Protected_Test()
//{
// #region Stubs
// var userId1 = 1;
// var acct1 = "user1";
// var userId2 = 2;
// var acct2 = "user2";
// var users = new List<SyncTwitterUser>
// {
// new SyncTwitterUser
// {
// Id = userId1,
// Acct = acct1
// },
// new SyncTwitterUser
// {
// Id = userId2,
// Acct = acct2
// }
// };
// var settings = new InstanceSettings
// {
// FailingTwitterUserCleanUpThreshold = 300
// };
// #endregion
// #region Mocks
// var twitterUserServiceMock = new Mock<ICachedTwitterUserService>(MockBehavior.Strict);
// twitterUserServiceMock
// .Setup(x => x.GetUser(It.Is<string>(y => y == acct1)))
// .Returns(new TwitterUser
// {
// Protected = false
// });
// twitterUserServiceMock
// .Setup(x => x.GetUser(It.Is<string>(y => y == acct2)))
// .Returns(new TwitterUser
// {
// Protected = true
// });
// var twitterUserDalMock = new Mock<ITwitterUserDal>(MockBehavior.Strict);
// var removeTwitterAccountActionMock = new Mock<IRemoveTwitterAccountAction>(MockBehavior.Strict);
// #endregion
// var processor = new RefreshTwitterUserStatusProcessor(twitterUserServiceMock.Object, twitterUserDalMock.Object, removeTwitterAccountActionMock.Object, settings);
// var result = await processor.ProcessAsync(users.ToArray(), CancellationToken.None);
// #region Validations
// Assert.AreEqual(1, result.Length);
// Assert.IsTrue(result.Any(x => x.User.Id == userId1));
// twitterUserServiceMock.VerifyAll();
// twitterUserDalMock.VerifyAll();
// removeTwitterAccountActionMock.VerifyAll();
// #endregion
//}
[TestMethod]
public async Task ProcessAsync_Error_NotInit_Test()
{
@ -720,9 +642,6 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
.Setup(x => x.GetUser(It.Is<string>(y => y == acct1)))
.Returns((TwitterUser)null);
//twitterUserServiceMock
// .Setup(x => x.PurgeUser(It.Is<string>(y => y == acct1)));
var twitterUserDalMock = new Mock<ITwitterUserDal>(MockBehavior.Strict);
twitterUserDalMock
.Setup(x => x.GetTwitterUserAsync(It.Is<string>(y => y == acct1)))
@ -790,10 +709,7 @@ namespace BirdsiteLive.Pipeline.Tests.Processors
twitterUserServiceMock
.Setup(x => x.GetUser(It.Is<string>(y => y == acct2)))
.Throws(new RateLimitExceededException());
//twitterUserServiceMock
// .Setup(x => x.PurgeUser(It.Is<string>(y => y == acct2)));
var twitterUserDalMock = new Mock<ITwitterUserDal>(MockBehavior.Strict);
twitterUserDalMock
.Setup(x => x.GetTwitterUserAsync(It.Is<string>(y => y == acct2)))