public void TestGenerateWithoutParticipants() { // Arrange var participants = new List <Participant>(); var timestamp = new DateTime(2021, 5, 7, 17, 20, 0); // Act var conversations = _sut.Generate(participants, null, timestamp); // Assert Assert.That(conversations.Count, Is.EqualTo(0)); }
public async Task <IActionResult> GenerateNewRound(DateTime timestamp) { if (timestamp == DateTime.MinValue) { ModelState.AddModelError("Timestamp", "Please enter a valid timestamp."); var viewModels = await GetConversationListItemViewModels(); return(View("Index", viewModels)); } var conversations = _context.Conversation.ToList(); var newConversations = _roundGenerator.Generate(_context.Participant.ToList(), conversations, timestamp); await _context.AddRangeAsync(newConversations); await _context.SaveChangesAsync(); return(RedirectToAction(nameof(Index))); }