public void GetRegistration()
        {
            // Act
            var result = _target.Registration();

            // Assert
            var viewResult = Assert.IsType <ViewResult>(result);

            Assert.NotNull(viewResult.ViewData);
        }
Exemplo n.º 2
0
        public void Registration_Get_ReturnView()
        {
            CreateController();

            var actionResult = _registrationController.Registration();

            var viewResult = Assert.IsType <ViewResult>(actionResult);

            Assert.Null(viewResult.ViewName);
        }
        public void RegistrationCheckReturnUser_Test()
        {
            var registrationModel = new Register {
                UserName = "******", Password = "******", ConfirmPassword = "******"
            };
            var  mock = new Mock <IUserService>();
            User user = new User {
                Id = 1, UserName = "******", Password = "******", RoleId = 2, Role = new Role {
                    Name = "user"
                }
            };

            mock.Setup(repo => repo.CreateUser(registrationModel.UserName, registrationModel.Password)).Returns(async() => { return(user); });

            var registerController = new RegistrationController(mock.Object);

            var result = registerController.Registration(registrationModel);

            Assert.IsType <User>(result.Result);
        }
Exemplo n.º 4
0
        public void Registration_ShouldReturnOk()
        {
            var req = new StandartAuthRequest
            {
                Email    = "*****@*****.**",
                Name     = "test",
                Password = "******"
            };
            HttpResponseMessage response = _controller.Registration(req);
            var result = TestHelper.ParseRegistrationResponse(response);

            Assert.IsNotNull(result);
            Assert.AreEqual(HttpStatusCode.Created.ToString(), result.StatusCode);
            Assert.AreEqual(true, result.IsSuccessStatusCode);
            Assert.AreEqual(ApiResult.Created, result.ApiResult);
            Assert.IsNotNull(result.Data);
        }