public void ModifyUserStatusCreatesEvent() { // Arrange var userId = new Guid("00000000-0000-0000-0000-000000000001"); const UserStatusEnum USER_STATUS = UserStatusEnum.Active; var mockUserEventDao = MockRepository.GenerateMock<IUserEventDao>(); mockUserEventDao.Expect(u => u.Create(Arg<UserEvent>.Is.Anything)); var userManager = new UserManager(); userManager.UserEventDao = mockUserEventDao; userManager.UserExtensionDao = MockRepository.GenerateStub<IUserExtensionDao>(); // Act userManager.ModifyUserSatus(userId, USER_STATUS, "notes"); // Assert mockUserEventDao.VerifyAllExpectations(); }
public void ModifyUserStatusCreatesEventWithNotes() { // Arrange var userId = new Guid("00000000-0000-0000-0000-000000000001"); const UserStatusEnum USER_STATUS = UserStatusEnum.Active; const string NOTES = "test notes"; var mockUserEventDao = MockRepository.GenerateMock<IUserEventDao>(); mockUserEventDao.Expect(u => u.Create(Arg<UserEvent>.Matches(ue => ue.Notes == NOTES))); var userManager = new UserManager(); userManager.UserEventDao = mockUserEventDao; userManager.UserExtensionDao = MockRepository.GenerateStub<IUserExtensionDao>(); // Act userManager.ModifyUserSatus(userId, USER_STATUS, NOTES); // Assert mockUserEventDao.VerifyAllExpectations(); }
public void ModifyUserStatusCallsToModifyUserStatusInDao() { // Arrange var userId = new Guid("00000000-0000-0000-0000-000000000001"); const UserStatusEnum USER_STATUS = UserStatusEnum.Active; var mockUserExtensionDao = MockRepository.GenerateMock<IUserExtensionDao>(); mockUserExtensionDao.Expect(u => u.ModifyUserSatus(userId, USER_STATUS)).Return(true); var userManager = new UserManager(); userManager.UserExtensionDao = mockUserExtensionDao; // Act userManager.ModifyUserSatus(userId, USER_STATUS, "notes"); // Assert mockUserExtensionDao.VerifyAllExpectations(); }
public void SetUp() { userManager = new UserManager(); }
public void SetUp() { userManager = new UserManager(); validUser = UserHelper.SetupUser(); }
public void ModifyUserStatusWithEmptyNotesThrowsException() { // Arrange var userId = new Guid("00000000-0000-0000-0000-000000000001"); const UserStatusEnum USER_STATUS = UserStatusEnum.Active; const string NOTES = ""; var userManager = new UserManager(); userManager.UserEventDao = MockRepository.GenerateStub<IUserEventDao>(); userManager.UserExtensionDao = MockRepository.GenerateStub<IUserExtensionDao>(); // Act try { userManager.ModifyUserSatus(userId, USER_STATUS, NOTES); Assert.Fail("ValidationException was expected"); } catch (ValidationException ex) { Assert.AreEqual(ex.Code, "SRVEX30051", "Exception code returned is incorrect."); } }
public void ModifyUserStatusCreatesRelatedEventType(UserStatusEnum userStatus, UserEventTypesEnum expectedUserEvent) { // Arrange var userId = new Guid("00000000-0000-0000-0000-000000000001"); string expectedUserEventCode = expectedUserEvent.GetCode(); var mockUserEventDao = MockRepository.GenerateMock<IUserEventDao>(); mockUserEventDao.Expect(u => u.Create(Arg<UserEvent>.Matches(ue => ue.UserEventType.Code == expectedUserEventCode))); var userManager = new UserManager(); userManager.UserEventDao = mockUserEventDao; userManager.UserExtensionDao = MockRepository.GenerateStub<IUserExtensionDao>(); // Act userManager.ModifyUserSatus(userId, userStatus, "notes"); // Assert mockUserEventDao.VerifyAllExpectations(); }