public IActionResult Register(RegisterPageViewModel model) { if (ModelState.IsValid) { User user = new User { Name = model.Username, Email = model.Email, Password = model.Password }; _auraLogic.NewAura(); _accountLogic.CreateUser(user); return(RedirectToAction("Index", "Home")); } return(View(model)); }
public void CreatePost_Expects_True() { _auraLogic.NewAura(); Category category = _categoryLogic.GetCategoryById(1); User user = _userLogic.GetUserById(1); Post post = new Post() { Title = "let's go bois", Content = "gamertime", PostDate = DateTime.Now, User = user, Category = category, Aura = _mockAuraRepo.AuraList.LastOrDefault() }; _postLogic.CreatePost(post); Assert.AreEqual(4, _mockPostRepo.PostList.Count()); }
public IActionResult Index(SubmitPageViewModel model) { if (ModelState.IsValid) { Post post = new Post { Title = model.Title, Content = model.Content, Category = new Category() { CategoryId = model.CategoryId }, User = new User() { UserId = (int)HttpContext.Session.GetInt32("UserId") } }; _auraLogic.NewAura(); _postLogic.CreatePost(post); return(RedirectToAction("Index", "Home")); } return(View(model)); }
public void NewAura_Expects_true() { _auraLogic.NewAura(); Assert.AreEqual(1, _mockAuraRepo.AuraList.Count); }