public void SendCorrectEmailWhenNotMember() { var myNotificationService = new NotificationService(_mockIQueryUsersByEmail, _mockEmailSender); Mock.Arrange(() => _mockIQueryUsersByEmail.UserWithEmailExists(Arg.IsAny<string>())) .Returns(false); myNotificationService.SendNotification("", "", ""); string expectedBody = @" added you as a friend on PluralSightBook! Click here to register your own account and then add them as your friend: http://localhost:56693/QuickAddFriend.aspx?email="; Mock.Assert(() => _mockEmailSender.SendEmail(expectedBody), Occurs.Once()); }
public void SendCorrectEmailWhenAlreadyFriends() { var myNotificationService = new NotificationService(_mockIQueryUsersByEmail, _mockEmailSender); Mock.Arrange(() => _mockIQueryUsersByEmail.UserWithEmailExists(Arg.IsAny<string>())) .Returns(true); Mock.Arrange(() => _mockIQueryUsersByEmail.GetUserByEmail(Arg.IsAny<string>())) .Returns(new User()); Mock.Arrange(() => _mockIQueryUsersByEmail.IsUserWithEmailFriendOfUser(Arg.IsAny<Guid>(), Arg.IsAny<string>())) .Returns(true); myNotificationService.SendNotification("", "", ""); string expectedBody = @"Good News! Your friend just added you as a friend!"; Mock.Assert(() => _mockEmailSender.SendEmail(expectedBody), Occurs.Once()); }