示例#1
0
        public void It_should_change_status_to_rejected_when_requested()
        {
            // Given
            var leader = new User(_leaderId, LeaderName);
            var user   = new User(_userId, UserName, leader);
            var item   = new WishListItem(
                WishListItemStatus.Requested,
                user,
                CostAmountWithAdditionalAcceptance);

            // When
            item.RejectBy(leader);

            // Then
            Assert.That(item.Status, Is.EqualTo(WishListItemStatus.Rejected));
        }
示例#2
0
        public void It_should_throw_exception_for_changing_from_requested_without_permission()
        {
            // Given
            var leader = new User(_leaderId, LeaderName);
            var user   = new User(_userId, UserName, leader);
            var item   = new WishListItem(
                WishListItemStatus.Requested,
                user,
                CostAmountWithoutAdditionalAcceptance);

            // When
            // Then
            Assert.Throws <UserDoesNotHavePermissionToRejectRequestedWishListItemException>(() =>
            {
                item.RejectBy(user);
            });
        }
示例#3
0
        public void It_should_change_status_to_rejected_when_requested_to_director()
        {
            // Given
            var director   = new User(_directorId, DirectorName);
            var department = new Department(DepartmentName, director);
            var user       = new User(
                _userId,
                UserName,
                department: department);

            var item = new WishListItem(
                WishListItemStatus.RequestedToDirector,
                user,
                CostAmountWithAdditionalAcceptance);

            // When
            item.RejectBy(director);

            // Then
            Assert.That(item.Status, Is.EqualTo(WishListItemStatus.Rejected));
        }
示例#4
0
        public void It_should_throw_exception_for_changing_from_requested_to_director_without_permission()
        {
            // Given
            var director   = new User(_directorId, DirectorName);
            var department = new Department(DepartmentName, director);
            var user       = new User(
                _userId,
                UserName,
                department: department);

            var item = new WishListItem(
                WishListItemStatus.RequestedToDirector,
                user,
                CostAmountWithAdditionalAcceptance);

            // When
            // Then
            Assert.Throws <UserDoesNotHavePermissionToRejectRequestedWishListItemException>(() =>
            {
                item.RejectBy(user);
            });
        }
示例#5
0
        public void It_should_throw_exception_for_incorrect_status(WishListItemStatus status)
        {
            // Given
            var leader = new User(_leaderId, LeaderName);
            var user   = new User(_userId, UserName, leader);

            var item = new WishListItem(
                status,
                user,
                CostAmountWithoutAdditionalAcceptance);

            // When
            // Then
            Assert.Throws <CannotRejectWishListItemWithCurrentStatusException>(() => { item.RejectBy(leader); });
        }