public void Initialize()
        {
            DapperTypeHandlerRegistration.Register(FifthweekAssembliesResolver.Assemblies);

            // Required for non-database tests.
            this.target = new GetFeedbackUserDataDbStatement(new Mock <IFifthweekDbConnectionFactory>(MockBehavior.Strict).Object);
        }
        public async Task WhenGetAccountSettingsCalledWithInvalidUserId_ItShouldThrowAnException()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.target = new GetFeedbackUserDataDbStatement(testDatabase);
                await this.CreateDataAsync(
                    testDatabase,
                    UserId,
                    Username,
                    Email);

                await testDatabase.TakeSnapshotAsync();

                Func <Task> badMethodCall = () => this.target.ExecuteAsync(new UserId(Guid.NewGuid()));

                await badMethodCall.AssertExceptionAsync <InvalidOperationException>();

                return(ExpectedSideEffects.None);
            });
        }
        public async Task WhenGetAccountSettingsCalled_ItShouldGetAccountSettingsFromTheDatabase()
        {
            await this.DatabaseTestAsync(async testDatabase =>
            {
                this.target = new GetFeedbackUserDataDbStatement(testDatabase);
                await this.CreateDataAsync(
                    testDatabase,
                    UserId,
                    Username,
                    Email);

                await testDatabase.TakeSnapshotAsync();

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

                var expectedResult = new GetFeedbackUserDataDbStatement.GetFeedbackUserDataResult(
                    Email,
                    Username);

                Assert.AreEqual(expectedResult, result);

                return(ExpectedSideEffects.None);
            });
        }