Beispiel #1
0
        public void Should_Throw_SecurityException_If_Non_Creator_Tries_To_Delete_Note(int groupCreatorId, int noteCreatorId)
        {
            //ARRANGE
            var group = new GroupEntity {
                CreatorId = groupCreatorId
            };
            var note = new NoteEntity {
                CreatorId = noteCreatorId
            };
            var userId = 20;

            //ACT && ASSERT
            Assert.Throws <SecurityException>(() => SecurityAssertions.AssertThatIssuerIsAuthorizedToDeleteNote(note, group, userId));
        }
Beispiel #2
0
        public void Group_Creator_Should_Be_Able_To_Delete_Note(int groupCreatorId, int noteCreatorId)
        {
            //ARRANGE
            var note = new NoteEntity {
                CreatorId = noteCreatorId
            };
            var group = new GroupEntity {
                CreatorId = groupCreatorId
            };
            var userId = groupCreatorId;

            //ACT && ASSERT
            Assert.DoesNotThrow(() => SecurityAssertions.AssertThatIssuerIsAuthorizedToDeleteNote(note, group, userId));
        }
 private void AssertThatRequestCameFromCreatorOrGroupAdmin(NoteEntity note, GroupEntity group, int userId)
 {
     SecurityAssertions.AssertThatIssuerIsAuthorizedToDeleteNote(note, group, userId);
 }