public void CanGetUserMessages() { var mockClass = new MessageSend(); var testClass = new MessageGet(); var testMessage = new MessageModel { DateTime = DateTime.Now.ToString(), Message = "Hello World!", UserFrom = "Jack Black" }; var secondTestMessage = new MessageModel { DateTime = DateTime.Now.ToString(), Message = "Hello World!", UserFrom = "Jack Pink" }; mockClass.SendMessages(testMessage); mockClass.SendMessages(secondTestMessage); List <MessageModel> List = testClass.GetMessages(); Assert.AreEqual(List.First().Message, testMessage.Message); Assert.AreEqual(List.First().UserFrom, testMessage.UserFrom); }
public void TheMessageIsSentToTheDatabase() { var testModel = new MessageModel { DateTime = DateTime.Now.ToString(), Message = "Bye World!", UserTo = "Jack Smack" }; var testClass = new MessageSend(); Assert.AreEqual(testClass.SendMessages(testModel), true); }
public void CanGetMessagesFromTheDatabase() { var mockClass = new MessageSend(); var testClass = new MessageGet(); var testMessage = new MessageModel { DateTime = DateTime.Now.ToString(), Message = "Hello World!", UserTo = "Jack Black" }; mockClass.SendMessages(testMessage); List <MessageModel> List = testClass.GetMessages(); foreach (var item in List) { Assert.AreEqual(item.Message, testMessage.Message); Assert.AreEqual(item.UserTo, testMessage.UserTo); } }