public RedirectToActionResult ContactPage(string messageSender, string messageReceiver, string messageText) { message = new Message(); message.MessageSender = messageSender; message.MessageReceiver = messageReceiver; message.MessageText = messageText; MessageRepo.AddMessage(message); return(RedirectToAction("ContactPage")); }
public void AddMessage_with_correct_message() { //arrange string text = "test"; _serv.Setup(x => x.AddMessage(It.IsAny<String>())); //act MessageRepo repo = new MessageRepo(_serv.Object); repo.AddMessage(text); //assert _serv.Verify(f => f.AddMessage(text), Times.Once()); }
public void AddMessage_with_correct_message() { //arrange string text = "test"; _serv.Setup(x => x.AddMessage(It.IsAny <String>())); //act MessageRepo repo = new MessageRepo(_serv.Object); repo.AddMessage(text); //assert _serv.Verify(f => f.AddMessage(text), Times.Once()); }
public void AddMessage_with_correct_message() { //arrange string text = "test"; Message msg; _add.Setup(x => x.AddMessage(It.IsAny <Message>())); //act MessageRepo repo = new MessageRepo(_add.Object, _get.Object); repo.AddMessage(text); //assert _add.Verify(f => f.AddMessage(It.Is <Message>(m => m.Text == text)), Times.Once()); }
public HomeController() { if (MessageRepo.Messages.Count == 0) { message = new Message() { MessageSender = "John", MessageReceiver = "Jane", MessageText = "Hello" }; MessageRepo.AddMessage(message); } if (UserDirectory.Users.Count == 0) { UserDirectory.AddUser(John); UserDirectory.AddUser(Jane); } }