public async Task ItShouldReturnAllResultsForCreator2()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.target = new GetCreatorFreeAccessUsersSnapshotsDbStatement(testDatabase);

                var userIds = await this.CreateDataAsync(testDatabase);
                await testDatabase.TakeSnapshotAsync();

                var result = await this.target.ExecuteAsync(CreatorId2, Now, Now.AddDays(Days));

                Assert.AreEqual(Days, result.Count);

                result = result.OrderBy(v => v.Timestamp).ToList();

                for (int i = 0; i < result.Count; i++)
                {
                    Assert.AreEqual(CreatorId2, result[i].CreatorId);
                    Assert.AreEqual(Now.AddDays(i).AddHours(12), result[i].Timestamp);
                    Assert.IsTrue(result[i].Timestamp.Kind == DateTimeKind.Utc);
                    Assert.IsTrue(result[i].FreeAccessUserEmails[0].Contains(i + "@test2.com"));
                    Assert.IsTrue(result[i].FreeAccessUserEmails[1].Contains(i + "@test2.com"));
                }

                return(ExpectedSideEffects.None);
            });
        }
        public async Task ItShouldReturnSubsetOfResultsForCreator1()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.target = new GetCreatorFreeAccessUsersSnapshotsDbStatement(testDatabase);

                var userIds = await this.CreateDataAsync(testDatabase);
                await testDatabase.TakeSnapshotAsync();

                // Two fewer results at the end, and one fewer at the beginning as we select first
                // result in front of timestamp.
                var result = await this.target.ExecuteAsync(CreatorId1, Now.AddHours(18).AddDays(1), Now.AddDays(Days - 2));

                Assert.AreEqual(Days - 3, result.Count);

                result = result.OrderBy(v => v.Timestamp).ToList();

                for (int i = 0; i < result.Count; i++)
                {
                    Assert.AreEqual(CreatorId1, result[i].CreatorId);
                    Assert.AreEqual(Now.AddDays(i + 1), result[i].Timestamp);
                    Assert.IsTrue(result[i].Timestamp.Kind == DateTimeKind.Utc);
                    Assert.IsTrue(result[i].FreeAccessUserEmails[0].Contains((i + 1) + "@test.com"));
                    Assert.IsTrue(result[i].FreeAccessUserEmails[1].Contains((i + 1) + "@test.com"));
                }

                return(ExpectedSideEffects.None);
            });
        }
 public void Test()
 {
     this.target = new GetCreatorFreeAccessUsersSnapshotsDbStatement(new Mock <IFifthweekDbConnectionFactory>(MockBehavior.Strict).Object);
 }