diff --git a/Rnwood.Smtp4dev.Tests/Controllers/MessagesControllerTests.cs b/Rnwood.Smtp4dev.Tests/Controllers/MessagesControllerTests.cs index ff25dfc5f..3b0e5ed50 100644 --- a/Rnwood.Smtp4dev.Tests/Controllers/MessagesControllerTests.cs +++ b/Rnwood.Smtp4dev.Tests/Controllers/MessagesControllerTests.cs @@ -130,6 +130,7 @@ public async Task GetMessage_ValidMime() var dbMessage = await new MessageConverter().ConvertAsync(message, [to]); dbMessage.Mailbox = new DbModel.Mailbox { Name = MailboxOptions.DEFAULTNAME }; + dbMessage.Folder = new DbModel.Folder { Name = "INBOX", Path = "INBOX"}; return dbMessage; } diff --git a/Rnwood.Smtp4dev.Tests/Controllers/RelayMessageTests.cs b/Rnwood.Smtp4dev.Tests/Controllers/RelayMessageTests.cs index 48007e1d1..d68a368b9 100644 --- a/Rnwood.Smtp4dev.Tests/Controllers/RelayMessageTests.cs +++ b/Rnwood.Smtp4dev.Tests/Controllers/RelayMessageTests.cs @@ -32,7 +32,7 @@ public RelayMessagesTests() var sqlLiteForTesting = new SqliteInMemory(); context = new Smtp4devDbContext(sqlLiteForTesting.ContextOptions); InitRepo(); - messagesRepository.GetMessages(Arg.Any(), Arg.Any()) + messagesRepository.GetMessages(Arg.Any(), null, Arg.Any()) .Returns(context.Messages); messagesRepository.TryGetMessageById(Arg.Any(), Arg.Any()) diff --git a/Rnwood.Smtp4dev.Tests/TestMessagesRepository.cs b/Rnwood.Smtp4dev.Tests/TestMessagesRepository.cs index b0d921dac..948fadfed 100644 --- a/Rnwood.Smtp4dev.Tests/TestMessagesRepository.cs +++ b/Rnwood.Smtp4dev.Tests/TestMessagesRepository.cs @@ -23,19 +23,28 @@ public Task DeleteAllMessages(string mailboxName) } public Smtp4devDbContext DbContext => throw new NotImplementedException(); - - public Task DeleteMessage(Guid id) + public Task CopyMessageToFolder(Guid id, string targetFolder) { - Messages.RemoveAll(m => m.Id == id); + var message = Messages.FirstOrDefault(m => m.Id == id); + if (message != null) + { + message.Folder = new Folder() { Name = targetFolder, Path = targetFolder }; + } return Task.CompletedTask; } - public IQueryable GetAllMessages(bool unTracked = true) + public IQueryable GetMessages(string mailboxName, string folder = null, bool unTracked = true) { return Messages.AsQueryable(); } - public IQueryable GetMessages(string mailboxName, bool unTracked = true) + public Task DeleteMessage(Guid id) + { + Messages.RemoveAll(m => m.Id == id); + return Task.CompletedTask; + } + + public IQueryable GetAllMessages(bool unTracked = true) { return Messages.AsQueryable(); }