public void Should_Throw_SecurityException_If_User_Does_Not_Belong_To_Group() { //ARRANGE var testSubjectUserId = 3; var groupId = 10; var group = new GroupEntity { GroupId = groupId, UserGroups = new List <UserGroupEntity> { new UserGroupEntity { GroupId = groupId, UserId = 1 }, new UserGroupEntity { GroupId = groupId, UserId = 2 } } }; //ACT && ASSERT Assert.Throws <SecurityException>(() => SecurityAssertions.AssertThatUserBelongsToGroup(group, testSubjectUserId)); }
public CloudBlockBlob GetAttachmentForNote(int userId, int noteId) { var note = GetNote(noteId); SecurityAssertions.AssertThatUserBelongsToGroup(note.Group, userId); var file = GetBlobFromStorage(note.AttachmentIdentity); return(file); }