public async Task GetFileByMessageAsync_ShouldReturnDto()
        {
            // ARRANGE
            var expectedFileName = GetTestMessageFiles().First().Name;
            var expectedFileType = GetTestFileTypes().First().Type;
            var expected         = new FileDto {
                FileBytes = new byte[] { 1, 0, 1, 0 }, FileName = expectedFileName, FileType = expectedFileType
            };

            var mockFileService = new Mock <IFileService <ChatFilesConfiguration> >();

            mockFileService
            .Setup(f => f.GetFileBytes(It.IsAny <string>()))
            .Returns(expected.FileBytes);

            var mockContextFactory = SetupContextFactory(null, null, null);

            _sut = new StudentChatService(mockContextFactory.Object, mockFileService.Object, _mapper);

            // ACT
            var actual = await _sut.GetFileByMessageAsync(1);

            // ASSERT
            Assert.Equal(ComparableObject.Convert(expected), ComparableObject.Convert(actual.Entity));
        }
        public async Task GetFileByMessageAsync_ShouldReturnErrorWhenMessageFileNotFound()
        {
            // ARRANGE
            var mockFileService    = new Mock <IFileService <ChatFilesConfiguration> >();
            var mockContextFactory = SetupContextFactory(null, null, null);

            _sut = new StudentChatService(mockContextFactory.Object, mockFileService.Object, _mapper);

            // ACT
            var actual = await _sut.GetFileByMessageAsync(6);

            // ASSERT
            Assert.Equal("Файл отсутствует в данном сообщении", actual.Error.Message);
        }
        public async Task GetFileByMessageAsync_ShouldReturnErrorWhenExceptionInQuery()
        {
            // ARRANGE
            var mockFileService = new Mock <IFileService <ChatFilesConfiguration> >();

            mockFileService.Setup(f => f.GetFileBytes(It.IsAny <string>()))
            .Throws(new Exception("Mock exception"));

            var mockContextFactory = SetupContextFactory(null, null, null);

            _sut = new StudentChatService(mockContextFactory.Object, mockFileService.Object, _mapper);

            // ACT
            var actual = await _sut.GetFileByMessageAsync(1);

            // ASSERT
            Assert.Equal("Mock exception", actual.Error.Message);
        }