public async Task WhenCheckingFileOwnership_ItShouldFailIfNoFilesMatchUser()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.target = new FileOwnership(testDatabase);
                await this.CreateFileAsync(new UserId(Guid.NewGuid()), FileId, testDatabase);
                await testDatabase.TakeSnapshotAsync();

                var result = await this.target.IsOwnerAsync(UserId, FileId);

                Assert.IsFalse(result);
                return(ExpectedSideEffects.None);
            });
        }
        public async Task WhenCheckingFileOwnership_ItShouldPassIfAtLeastOneFileMatchesFileAndUser()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.target = new FileOwnership(testDatabase);
                await this.CreateFileAsync(UserId, FileId, testDatabase);
                await testDatabase.TakeSnapshotAsync();

                var result = await this.target.IsOwnerAsync(UserId, FileId);

                Assert.IsTrue(result);
                return(ExpectedSideEffects.None);
            });
        }
        public async Task WhenCheckingFileOwnership_ItShouldFailIfNoFilesExist()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.target = new FileOwnership(testDatabase);

                using (var databaseContext = testDatabase.CreateContext())
                {
                    await databaseContext.Database.Connection.ExecuteAsync("DELETE FROM Likes;DELETE FROM Comments;DELETE FROM Posts;DELETE FROM Files");
                }

                await testDatabase.TakeSnapshotAsync();

                var result = await this.target.IsOwnerAsync(UserId, FileId);

                Assert.IsFalse(result);
                return(ExpectedSideEffects.None);
            });
        }