コード例 #1
0
            public async Task WhenRegisterSucceedsReturnsSuccess()
            {
                var request = new RegisterAccountRequest
                {
                    Email = "*****@*****.**"
                };

                UserServiceMock
                .Setup(us => us.RegisterUserAsync(It.IsAny <RegisterAccountRequest>(), It.IsAny <string>()))
                .ReturnsAsync(RegisterAccountResult.Succeeded(new GametekiUser {
                    Settings = new UserSettings()
                }));

                var result = await Controller.RegisterAccount(request);

                var response = TestUtils.GetResponseFromResult <ApiResponse>(result);

                Assert.IsTrue(response.Success);
            }
コード例 #2
0
            public async Task WhenActivationEnabledSendVerificationEmail()
            {
                var request = new RegisterAccountRequest
                {
                    Email = "*****@*****.**"
                };

                ApiOptions.Value.AccountVerification = true;

                UserServiceMock
                .Setup(us => us.RegisterUserAsync(It.IsAny <RegisterAccountRequest>(), It.IsAny <string>()))
                .ReturnsAsync(RegisterAccountResult.Succeeded(new GametekiUser {
                    Settings = new UserSettings()
                }));

                var result = await Controller.RegisterAccount(request);

                var response = TestUtils.GetResponseFromResult <ApiResponse>(result);

                Assert.IsTrue(response.Success);
                UserServiceMock.Verify(
                    us => us.SendActivationEmailAsync(It.IsAny <GametekiUser>(), It.IsAny <AccountVerificationModel>()),
                    Times.Once);
            }