示例#1
0
        public async Task ReturnSpecialityDto_WhenSpecialityExists()
        {
            var handler = new GetSpecialityQueryHandler(Context);

            var result = await handler.Handle(new GetSpecialityQuery { Id = 1 }, CancellationToken.None);

            Assert.IsInstanceOf(typeof(SpecialityDto), result);
        }
示例#2
0
        public async Task ThrowNotFoundException_WhenSpecialityIsNotExists()
        {
            var notExistingSubjectId = 1000;
            var handler = new GetSpecialityQueryHandler(Context);

            var exception = Assert.ThrowsAsync <NotFoundException>(async() => await handler.Handle(new GetSpecialityQuery {
                Id = notExistingSubjectId
            }, CancellationToken.None));

            Assert.AreEqual(exception.Message, ExceptionMessagesBuilderHelper.GetNotFoundExceptionMessage(nameof(Speciality), notExistingSubjectId));
        }