public async Task Handler_ShouldReturnNotFound_WhenTagNotFound() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var query = new GetTagAttachmentsQuery(0); var dut = new GetTagAttachmentsQueryHandler(context); var result = await dut.Handle(query, default); Assert.IsNotNull(result); Assert.AreEqual(ResultType.NotFound, result.ResultType); Assert.IsNull(result.Data); } }
public async Task Handler_ShouldReturnAttachments() { using (var context = new PreservationContext(_dbContextOptions, _plantProvider, _eventDispatcher, _currentUserProvider)) { var query = new GetTagAttachmentsQuery(_tagId); var dut = new GetTagAttachmentsQueryHandler(context); var result = await dut.Handle(query, default); Assert.IsNotNull(result); Assert.AreEqual(ResultType.Ok, result.ResultType); var attachmentDtos = result.Data; Assert.AreEqual(1, attachmentDtos.Count); var attachment = attachmentDtos.Single(); Assert.AreEqual(_attachment.Id, attachment.Id); Assert.AreEqual(_attachment.FileName, attachment.FileName); } }