public void SignUp_ShouldRegUser()
        {
            var context = GetContext();
            var controller = new AccountController(context);

            controller.SignUp(new Models.ViewModels.UserViewModel()
            {
                Name = "ivan",
                Pass = "******"
            });

            var user = context.Users.Auth("ivan", "ivan");
            Assert.IsNotNull(user);
        }
        public void SignUp_ShouldReturnSession()
        {
            var context = GetContext();
            var controller = new AccountController(context);

            var result = controller.SignUp(new UserViewModel()
            {
                Name = "ivan",
                Pass = "******"
            }) as OkNegotiatedContentResult<SessionViewModel>;

            Assert.IsNotNull(result);
            Assert.IsNotNull(context.Sessions.Find(result.Content.Id));
        }
        public void SignUp_ShouldReturnBadRequest_IfNameAlreadyExists()
        {
            var context = GetContext();
            var controller = new AccountController(context);

            context.Users.RegUser("ivan","asd");

            var result = controller.SignUp(new UserViewModel()
            {
                Name = "ivan",
                Pass = "******"
            });

            Assert.IsInstanceOfType(result, typeof(BadRequestErrorMessageResult));
        }