public void ChangeProfileTest()
 {
     UsersController target = new UsersController(userRepository);
     User user = userRepository.CreateUser("Test", "Test", "*****@*****.**");
     target = (UsersController)TestHelper.CreateControllerForUser(user, target);
     HttpPostedFileBase image = null;
     ActionResult actual;
     actual = target.ChangeProfile(user, image);
     Assert.IsNotNull(actual);
     Assert.IsTrue(actual is RedirectToRouteResult);
     userRepository.DeleteUser(user);
 }
 public void AddSubscriptionTest()
 {
     var userlogin = userRepository.CreateUser("Test", "Test");
     var testUser = userRepository.CreateUser("Test2", "Test");
     UsersController target = new UsersController(userRepository);
     target = (UsersController)TestHelper.CreateControllerForUser(userlogin, target);
     int whomUserId = testUser.Id;
     var actual = target.AddSubscription(whomUserId);
     Assert.IsNotNull(actual);
     Assert.IsTrue(actual is EmptyResult);
     userRepository.DeleteUser(userlogin);
     userRepository.DeleteUser(testUser);
 }
 public void ChangeProfileTest1()
 {
     UsersController target = new UsersController(userRepository);
     User user = userRepository.CreateUser("Test", "Test");
     target = (UsersController)TestHelper.CreateControllerForUser(user, target);
     ActionResult actual;
     actual = target.ChangeProfile();
     Assert.IsNotNull(actual);
     Assert.IsTrue(actual is ViewResult);
     userRepository.DeleteUser(user);
 }
 public void UnsubscribeTest()
 {
     UsersController target = new UsersController(userRepository);
     User whoUser = userRepository.CreateUser("Test","Test");
     target = (UsersController)TestHelper.CreateControllerForUser(whoUser, target);
     User whomUser = userRepository.CreateUser("Test1", "Test");
     userRepository.AddSubscription(whoUser, whomUser);
     ActionResult actual;
     actual = target.Unsubscribe(whomUser.Id);
     Assert.IsNotNull(actual);
     Assert.IsTrue(actual is EmptyResult);
     Assert.AreEqual(userRepository.GetCountReadUsers(whoUser.Id), 0);
     userRepository.DeleteUser(whoUser);
     userRepository.DeleteUser(whomUser);
 }
 public void GetUserMinDetailByIdTest()
 {
     UsersController target = new UsersController(userRepository);
     User user = userRepository.CreateUser("Test", "Test");
     ActionResult actual;
     actual = target.GetUserMinDetailById(user.Id);
     Assert.IsNotNull(actual);
     Assert.IsTrue(actual is PartialViewResult);
     userRepository.DeleteUser(user);
 }
 public void GetImageTest()
 {
     var img = Properties.Resources.Image1;
     var stream = new MemoryStream();
     img.Save(stream, ImageFormat.Jpeg);
     byte[] photo = stream.ToArray();
     UsersController target = new UsersController(userRepository);
     User user = userRepository.CreateUser("Test", "Test");
     userRepository.AddOrUpdatePhoto(user.Id, photo);
     ActionResult actual;
     actual = target.GetImage(user.Id);
     Assert.IsNotNull(actual);
     Assert.IsTrue(actual is FileResult);
     userRepository.DeleteUser(user);
 }