public async Task WhenCreatorExists_ShouldCreateSnapshot()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.guidCreator.Setup(v => v.CreateSqlSequential()).Returns(SnapshotId);
                this.timestampCreator.Setup(v => v.Create()).Returns(Now);

                this.target = new CreateSubscriberChannelsSnapshotDbStatement(
                    this.guidCreator.Object,
                    this.timestampCreator.Object,
                    testDatabase);

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

                await this.target.ExecuteAsync(SubscriberId);

                var expectedSubscriberChannelSnapshot = new SubscriberChannelsSnapshot(SnapshotId, Now, SubscriberId.Value);
                var expectedSubscriberChannelItem1    = new SubscriberChannelsSnapshotItem(SnapshotId, null, ChannelId1.Value, CreatorId.Value, AcceptedPrice1, Now);
                var expectedSubscriberChannelItem2    = new SubscriberChannelsSnapshotItem(SnapshotId, null, ChannelId2.Value, CreatorId.Value, AcceptedPrice2, Now);

                return(new ExpectedSideEffects
                {
                    Inserts = new List <IIdentityEquatable>
                    {
                        expectedSubscriberChannelSnapshot,
                        expectedSubscriberChannelItem1,
                        expectedSubscriberChannelItem2,
                    }
                });
            });
        }
Ejemplo n.º 2
0
 public ActiveSubscription(DateTime billingWeekEndDateExclusive, SubscriberChannelsSnapshotItem subscription)
 {
     this.BillingWeekEndDateExclusive = billingWeekEndDateExclusive;
     this.Subscription = subscription;
 }