示例#1
0
        public void Should_Throw_Exception_For_Invalid_IssuerId([Values(-1, 0, null)] int invalidIssuerId)
        {
            //ARRANGE
            var fixture = new NoteOperationsHandlerTestsFixture()
                          .ConfigureSut();

            var request = CreateValidCreateNoteRequest();
            var groupId = 86;

            //ACT && ASSERT
            var exception = Assert.Throws <Exception>(() => fixture.Sut.CreateNoteForGroup(request, groupId, invalidIssuerId));

            Assert.That(exception.Message, Is.EqualTo($"Could not find entity of type [{typeof(UserEntity).Name}]"));
        }
示例#2
0
        public void Should_Create_Note_For_Valid_Create_Input_Parameters()
        {
            //ARRANGE
            var issuerId = 100;
            var groupId  = 100;
            var fixture  = new NoteOperationsHandlerTestsFixture()
                           .SetupUserRepositoryToReturnUserForId(issuerId)
                           .SetupGroupRepositoryToReturnGroupForId(groupId)
                           .ConfigureSut();

            var request = CreateValidCreateNoteRequest();

            //ACT && ASSERT
            Assert.DoesNotThrow(() => fixture.Sut.CreateNoteForGroup(request, groupId, issuerId));
        }
示例#3
0
        public void Should_Throw_Exception_For_Invalid_NoteId([Values(-1, 0, null)] int invalidNoteId)
        {
            //ARRANGE
            var issuerId    = 100;
            var editRequest = new EditNoteRequest
            {
                NoteId          = invalidNoteId,
                NoteName        = "noteName",
                NoteDescription = "NoteDescription"
            };
            var fixture = new NoteOperationsHandlerTestsFixture()
                          .SetupUserRepositoryToReturnUserForId(issuerId)
                          .ConfigureSut();

            //ACT && ASSERT
            var exception = Assert.Throws <Exception>(() => fixture.Sut.EditNote(editRequest, issuerId));

            Assert.That(exception.Message, Is.EqualTo($"Could not find entity of type [{typeof(NoteEntity).Name}]"));
        }