public async Task GetTwitterUserAsync_NoUser() { var dal = new TwitterUserPostgresDal(_settings); var result = await dal.GetTwitterUserAsync("dontexist"); Assert.IsNull(result); }
public async Task CreateAndGetUser_byId() { var acct = "myid"; var lastTweetId = 1548L; var dal = new TwitterUserPostgresDal(_settings); await dal.CreateTwitterUserAsync(acct, lastTweetId); var result = await dal.GetTwitterUserAsync(acct); var resultById = await dal.GetTwitterUserAsync(result.Id); Assert.AreEqual(acct, resultById.Acct); Assert.AreEqual(lastTweetId, resultById.LastTweetPostedId); Assert.AreEqual(lastTweetId, resultById.LastTweetSynchronizedForAllFollowersId); Assert.AreEqual(result.Id, resultById.Id); }
public async Task CreateAndDeleteUser() { var acct = "myid"; var lastTweetId = 1548L; var dal = new TwitterUserPostgresDal(_settings); await dal.CreateTwitterUserAsync(acct, lastTweetId); var result = await dal.GetTwitterUserAsync(acct); Assert.IsNotNull(result); await dal.DeleteTwitterUserAsync(acct); result = await dal.GetTwitterUserAsync(acct); Assert.IsNull(result); }
public async Task CreateUpdateAndGetUser() { var acct = "myid"; var lastTweetId = 1548L; var dal = new TwitterUserPostgresDal(_settings); await dal.CreateTwitterUserAsync(acct, lastTweetId); var result = await dal.GetTwitterUserAsync(acct); var updatedLastTweetId = 1600L; var updatedLastSyncId = 1550L; var now = DateTime.Now; await dal.UpdateTwitterUserAsync(result.Id, updatedLastTweetId, updatedLastSyncId, now); result = await dal.GetTwitterUserAsync(acct); Assert.AreEqual(acct, result.Acct); Assert.AreEqual(updatedLastTweetId, result.LastTweetPostedId); Assert.AreEqual(updatedLastSyncId, result.LastTweetSynchronizedForAllFollowersId); Assert.IsTrue(Math.Abs((now.ToUniversalTime() - result.LastSync).Milliseconds) < 100); }