Ejemplo n.º 1
0
        public void CheckThatNoMemberOfProjectCannotGetListOfMembers()
        {
            _mpur.Setup(r => r.GetRoleOfMember(It.IsAny <string>(), It.IsAny <int>())).ReturnsAsync(AppUserRole.None);

            IMemberBl mbl = new MemberBl(_mpur.Object, _mpr.Object, _mapper, _mur.Object);

            Assert.ThrowsAsync <NotFoundResponseException>(async() =>
                                                           await mbl.GetAllMembersOfProjectAsync(It.IsAny <string>(), It.IsAny <int>())).Wait();

            _mpur.Verify(r => r.GetMembersOfProject(It.IsAny <int>()), Times.Never);
        }
Ejemplo n.º 2
0
        public void CheckThatEveryMemberOfProjectCanViewGetOfMembers(string callerId)
        {
            _mpur.Setup(r => r.GetRoleOfMember("user-that-owner", It.IsAny <int>())).ReturnsAsync(AppUserRole.Owner);
            _mpur.Setup(r => r.GetRoleOfMember("user-that-master", It.IsAny <int>())).ReturnsAsync(AppUserRole.ScrumMaster);
            _mpur.Setup(r => r.GetRoleOfMember("user-that-dev", It.IsAny <int>())).ReturnsAsync(AppUserRole.Developer);
            _mpur.Setup(r => r.GetRoleOfMember("user-that-observer", It.IsAny <int>())).ReturnsAsync(AppUserRole.Observer);

            IMemberBl mbl = new MemberBl(_mpur.Object, _mpr.Object, _mapper, _mur.Object);

            var members = mbl.GetAllMembersOfProjectAsync(callerId, It.IsAny <int>()).Result;

            _mpur.Verify(r => r.GetMembersOfProject(It.IsAny <int>()), Times.Once);
        }