public void TestCaptionEmpty() { var emailSource = new EmailSourceStub("*****@*****.**"); var model = new Person("Name", emailSource); var emailSender = new EmailSenderDummy(); var viewModel = new PersonViewModel(model, emailSender); Assert.AreEqual("Name ([email protected])", viewModel.Caption, "incorrect person caption"); }
public void TestSimpleWithMock() { const string email = "*****@*****.**"; const string message = "It is a message"; var emailSource = new EmailSourceStub(email); var model = new Person("Name", emailSource); var emailSender = new EmailSenderMock(); var viewModel = new PersonViewModel(model, emailSender); var sendCommand = viewModel.Commands.First(); sendCommand.Command.Execute(message); Assert.IsTrue(emailSender.Verification(email, message), "incorrect mail"); }
public void TestSimpleWithSpy() { const string email = "*****@*****.**"; const string message = "It is a message"; var emailSource = new EmailSourceStub(email); var model = new Person("Name", emailSource); var emailSender = new EmailSenderSpy(); var viewModel = new PersonViewModel(model, emailSender); var sendCommand = viewModel.Commands.First(); sendCommand.Command.Execute(message); Assert.AreEqual(1, emailSender.Mails.Count, "incorrect mails"); var mail = emailSender.Mails.First(); Assert.AreEqual(email, mail.Address, "incorrect address"); Assert.AreEqual(message, mail.Message, "incorrect message"); }