Created
February 14, 2016 12:58
-
-
Save zs40x/5b8e5e88524d8f2812db to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[TestMethod] | |
public void isNonPremiumUserMailSentAndValid() | |
{ | |
var user = new User("A", "A@B.com", false); | |
var expectedSubject = "Notification"; | |
var expectedMessage = "Dear A this is a Notification!"; | |
var sendMail = Mock.Create<SendMail>(); | |
new NotificationService(sendMail).sendNotificationForUser(user); | |
Mock.Assert( | |
() => sendMail.sendMail(user.EMailAddress, expectedSubject, expectedMessage), | |
Occurs.Once(), | |
"sendMail() wasn't called as expected!" | |
); | |
} | |
[TestMethod] | |
public void isPremiumUserMailSendAndValid() | |
{ | |
var user = new User("Premium", "Premium@User.com", true); | |
var expectedSubject = "Notification"; | |
var expectedMessage = "Dear Premium this is a Notification! -> Additional Information for Premium Users!"; | |
var sendMail = Mock.Create<SendMail>(); | |
new NotificationService(sendMail).sendNotificationForUser(user); | |
Mock.Assert( | |
() => sendMail.sendMail(user.EMailAddress, expectedSubject, expectedMessage), | |
Occurs.Once(), | |
"sendMail() wasn't called as expected!" | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment