Esempio n. 1
0
        public async Task WhenUserIdExists_ItShouldReturnTheBlogSubscriptions()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.target = new GetBlogSubscriberInformationDbStatement(testDatabase);

                await this.CreateDataAsync(testDatabase);
                await testDatabase.TakeSnapshotAsync();

                var result = await this.target.ExecuteAsync(Blog1Id);

                CollectionAssert.AreEquivalent(
                    new List <GetBlogSubscriberInformationDbStatement.GetBlogSubscriberInformationDbStatementResult.Subscriber>
                {
                    new GetBlogSubscriberInformationDbStatement.GetBlogSubscriberInformationDbStatementResult.Subscriber(
                        Username1, UserId1, ProfileImageFileId1, Blog1ChannelIds[0], SubscriptionStartDate, 10, UserEmail1, PaymentStatus.Retry2, true),
                    new GetBlogSubscriberInformationDbStatement.GetBlogSubscriberInformationDbStatementResult.Subscriber(
                        Username1, UserId1, ProfileImageFileId1, Blog1ChannelIds[1], SubscriptionStartDate, 10, UserEmail1, PaymentStatus.Retry2, true),
                    new GetBlogSubscriberInformationDbStatement.GetBlogSubscriberInformationDbStatementResult.Subscriber(
                        Username2, UserId2, null, Blog1ChannelIds[0], SubscriptionStartDate, 20, null, PaymentStatus.Failed, false),
                    new GetBlogSubscriberInformationDbStatement.GetBlogSubscriberInformationDbStatementResult.Subscriber(
                        Username2, UserId2, null, Blog1ChannelIds[1], SubscriptionStartDate, 20, null, PaymentStatus.Failed, false),
                    new GetBlogSubscriberInformationDbStatement.GetBlogSubscriberInformationDbStatementResult.Subscriber(
                        Username3, UserId3, null, Blog1ChannelIds[1], SubscriptionStartDate, 30, null, PaymentStatus.None, false),
                },
                    result.Subscribers.ToList());


                return(ExpectedSideEffects.None);
            });
        }
Esempio n. 2
0
        public async Task WhenUserIdDoesNotExist_ItShouldReturnAnEmptyResultList()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.target = new GetBlogSubscriberInformationDbStatement(testDatabase);

                await this.CreateDataAsync(testDatabase);
                await testDatabase.TakeSnapshotAsync();

                var result = await this.target.ExecuteAsync(new BlogId(Guid.NewGuid()));
                Assert.AreEqual(0, result.Subscribers.Count);

                return(ExpectedSideEffects.None);
            });
        }
Esempio n. 3
0
 public void TestInitialize()
 {
     this.target = new GetBlogSubscriberInformationDbStatement(new Mock <IFifthweekDbConnectionFactory>(MockBehavior.Strict).Object);
 }