public void MailAction_PrintDefault_Verify() { var mockMailSender = new Mock <IMailSender>(); var mockMailCopy = new Mock <IMailCopy>(); var mockNotify = new Mock <INotify>(); var mockPrint = new Mock <IPrint>(); mockPrint.Setup(x => x.PrintTo(It.IsAny <MailEntity>())).Returns(true); var mailAction = new Action.MailAction(mockMailSender.Object, mockMailCopy.Object, mockNotify.Object, mockPrint.Object); var res = mailAction.ActionPrint(MailEntity); Assert.That(res, Is.True); }
public void MailAction_CopyToFolder_Verify() { var mockMailSender = new Mock <IMailSender>(); var mockMailCopy = new Mock <IMailCopy>(); var mockNotify = new Mock <INotify>(); var mockPrint = new Mock <IPrint>(); mockMailCopy.Setup(x => x.CopyTo(It.IsAny <ConfigEntity>(), It.IsAny <MailEntity>(), It.IsAny <string>())).Returns(true); var mailAction = new Action.MailAction(mockMailSender.Object, mockMailCopy.Object, mockNotify.Object, mockPrint.Object); var res = mailAction.ActionCopy(ConfigEntity, MailEntity, ConfigEntity.MailActions[2].ActTypeValue); Assert.That(res, Is.True); }
public void MailAction_Actions_WasCalled() { var mockMailSender = new Mock <IMailSender>(); var mockMailCopy = new Mock <IMailCopy>(); var mockNotify = new Mock <INotify>(); var mockPrint = new Mock <IPrint>(); var mailAction = new Action.MailAction(mockMailSender.Object, mockMailCopy.Object, mockNotify.Object, mockPrint.Object); mailAction.ActionSend(ConfigEntity, MailEntity, ConfigEntity.MailActions[3].ActTypeValue); mailAction.ActionCopy(ConfigEntity, MailEntity, ConfigEntity.MailActions[2].ActTypeValue); mailAction.ActionNotify(MailEntity); mailAction.ActionPrint(MailEntity); mockMailSender.Verify(x => x.SendTo(ConfigEntity, MailEntity, ConfigEntity.MailActions[3].ActTypeValue), Times.Once()); mockMailCopy.Verify(x => x.CopyTo(ConfigEntity, MailEntity, ConfigEntity.MailActions[2].ActTypeValue), Times.Once()); mockNotify.Verify(x => x.NotifyTo(MailEntity), Times.Once()); mockPrint.Verify(x => x.PrintTo(MailEntity), Times.Once()); }