public void Send_WhenGoodDocument() { var document = BuildDocument(file); A.CallTo(() => recognizer.TryRecognize(file, out document)) .Returns(true); A.CallTo(() => documentChecker.CheckDocument(document)) .Returns(true); A.CallTo(() => cryptographer.Sign(document.Content, certificate)) .Returns(signedContent); A.CallTo(() => sender.TrySend(signedContent)) .Returns(true); fileSender.TrySendFile(file, certificate) .Should().BeTrue(); }
public bool TrySendFile(File file, X509Certificate certificate) { Document document; if (!recognizer.TryRecognize(file, out document)) { return(false); } if (!documentChecker.CheckDocument(document)) { return(false); } var signedContent = cryptographer.Sign(document.Content, certificate); return(sender.TrySend(signedContent)); }
public void Pass_WhenGoodFormat(string format) { documentChecker.CheckDocument(new Document("someFile", null, specialDate, format)) .Should().BeTrue(); }