public void Controller_DeleteUser_Parameter_Valid() { controller = Controller.GetInstance(); testId = TestExtensions._testUser1.Id; try { controller.DeleteUser(testId); User user = _dao.GetUser(testId); Assert.Fail("No exception was thrown. "); } catch { //This is expected testId = int.MaxValue; } }
public void Controller_DeleteUser_State_ProperCascading() { controller = Controller.GetInstance(); testId = TestExtensions._testUser1.Id; try { controller.DeleteUser(testId); User user = _dao.GetUser(testId); Assert.Fail("No exception was thrown. "); } catch { List<Channel> userCreatedChannels = _dao.GetCreatedChannels(testId); Assert.IsTrue(userCreatedChannels.Count == 0); List<Comment> userCreatedComments = _dao.GetUserComments(testId, 0, int.MaxValue); Assert.IsTrue(userCreatedComments.Count == 0); List<Vote> userVotes = _dao.GetUserVotes(testId); Assert.IsTrue(userVotes.Count == 0); testId = int.MaxValue; } }
public void Controller_DeleteUser_Parameter_Neg() { controller = Controller.GetInstance(); testId = TestExtensions._testUser1.Id; try { controller.DeleteUser(-1); Assert.Fail("No exception was thrown"); } catch (ArgumentException) { //This is expected } }