public void _should_encrypt_before_sending() { _cryptoMock.Setup(x => x.Encrypt(It.Is <string>(s => s == input))).Verifiable(); _loggerMock.Setup(x => x.Info(It.IsAny <string>())).Verifiable(); var sut = new FedExSender(_cryptoMock.Object, _loggerMock.Object); sut.Send(input); _cryptoMock.Verify(x => x.Encrypt(It.Is <string>(s => s == input)), Times.Once); _loggerMock.Verify(x => x.Info(It.IsAny <string>()), Times.Once); _loggerMock.Verify(x => x.Error(It.IsAny <string>()), Times.Never); }
public void Should_Encrypt_First() { var cryptoMock = new Mock <IEncryptHelper>(); cryptoMock.Setup(x => x.Encrypt(It.Is <string>((str) => str == expectedText))).Returns(cryptoText).Verifiable(); var loggerMock = new Mock <IAppLogger>(); var sut = new FedExSender(cryptoMock.Object, loggerMock.Object); sut.Send(expectedText); cryptoMock.VerifyAll(); }