// POST: Workers/SendSlack/5 public async Task <IActionResult> SendSlack(int id, string author, string message) { var worker = await _context.Worker .SingleOrDefaultAsync(m => m.ID == id); _message.SendSlackMessage(author, message, worker.FirstName, worker.SecondName); return(View("AfterMessage")); }
public void Test1() { var client = Substitute.For <IMsgClient>(); var handler = new SlackHandler(client); var author = "a"; var message = "a"; var receiverFn = ""; var receiverLn = ""; var msg = new SlackMessage(); client.FormatMsg(author, message, receiverFn, receiverLn).Returns(msg); // Act handler.SendSlackMessage(author, message, receiverFn, receiverLn); // Assert client.Received().FormatMsg(author, message, receiverFn, receiverLn); client.Received().PostMsg(msg); }