public void CheckThatNoMemberCanNotViewAnyOtherMember() { _mpur.Setup(r => r.GetRoleOfMember(It.IsAny <string>(), It.IsAny <int>())).ReturnsAsync(AppUserRole.None); var bl = new MemberBl(_mpur.Object, _mpr.Object, _mapper, _mur.Object); Assert.ThrowsAsync <NotFoundResponseException>(async() => await bl.GetMemberOfProjectAsync(It.IsAny <string>(), It.IsAny <int>(), It.IsAny <string>())).Wait(); }
public void CheckThatNotFoundWillBeReturnedIfNoGivenMemberInProject() { _mpur.Setup(r => r.GetRoleOfMember("user-1", It.IsAny <int>())).ReturnsAsync(AppUserRole.Observer); _mpur.Setup(r => r.GetRoleOfMember("user-2", It.IsAny <int>())).ReturnsAsync(AppUserRole.None); var bl = new MemberBl(_mpur.Object, _mpr.Object, _mapper, _mur.Object); Assert.ThrowsAsync <NotFoundResponseException>(async() => await bl.GetMemberOfProjectAsync("user-1", It.IsAny <int>(), "user-2")).Wait(); }
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); }
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); }
public void CheckThatEveryMemberCanViewAnyOtherMember(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); string targetMemberId = "user-x"; _mur.Setup(r => r.GetByIdAsync(It.IsAny <string>())).ReturnsAsync(new User { Id = targetMemberId }); _mpur.Setup(r => r.GetRoleOfMember(targetMemberId, It.IsAny <int>())).ReturnsAsync(AppUserRole.Observer); var bl = new MemberBl(_mpur.Object, _mpr.Object, _mapper, _mur.Object); var memb = bl.GetMemberOfProjectAsync(callerId, It.IsAny <int>(), targetMemberId).Result; _mpur.Verify(r => r.GetRoleOfMember(callerId, It.IsAny <int>()), Times.Once); _mpur.Verify(r => r.GetRoleOfMember(targetMemberId, It.IsAny <int>()), Times.Once); _mur.Verify(r => r.GetByIdAsync(targetMemberId), Times.Once); }