コード例 #1
0
ファイル: UserManagerTests.cs プロジェクト: ognjenm/egle
            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();
            }
コード例 #2
0
ファイル: UserManagerTests.cs プロジェクト: ognjenm/egle
            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();
            }
コード例 #3
0
ファイル: UserManagerTests.cs プロジェクト: ognjenm/egle
            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();
            }
コード例 #4
0
ファイル: UserManagerTests.cs プロジェクト: ognjenm/egle
            public void SetUp()
            {
                userManager = new UserManager();

            }
コード例 #5
0
ファイル: UserManagerTests.cs プロジェクト: ognjenm/egle
            public void SetUp()
            {
                userManager = new UserManager();

                validUser = UserHelper.SetupUser();
            }
コード例 #6
0
ファイル: UserManagerTests.cs プロジェクト: ognjenm/egle
            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.");
                }
            }
コード例 #7
0
ファイル: UserManagerTests.cs プロジェクト: ognjenm/egle
            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();
            }