Example #1
0
        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();
        }
Example #2
0
        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));
        }
Example #3
0
 public void Pass_WhenGoodFormat(string format)
 {
     documentChecker.CheckDocument(new Document("someFile", null, specialDate, format))
     .Should().BeTrue();
 }