public void IsFileSigned_SignedFile_UntrustedCertificate_ReturnsTrue()
 {
     using (var signingTool = new AppxSigningTool(Log))
     {
         Assert.IsTrue(File.Exists("TestFiles/signed/signed.appx"));
         Assert.IsTrue(signingTool.IsFileSigned("TestFiles/signed/signed.appx"));
     }
 }
 public void IsFileSigned_SignedFile_TrustedCertificate_ReturnsTrue()
 {
     using (
         new CertificateStoreHelper("Certificates/SigningServer.Test.pfx", StoreName.Root,
                                    StoreLocation.LocalMachine))
     {
         using (var signingTool = new AppxSigningTool(Log))
         {
             Assert.IsTrue(File.Exists("TestFiles/signed/signed.appx"));
             Assert.IsTrue(signingTool.IsFileSigned("TestFiles/signed/signed.appx"));
         }
     }
 }
        public void SignFile_Unsigned_WrongPublishedFails()
        {
            using (var signingTool = new AppxSigningTool(Log))
            {
                var fileName    = "Unsigned_WrongPublishedFails/error/UnsignedWrongPublisher.appx";
                var certificate = new X509Certificate2("Certificates/SigningServer.Test.pfx");
                Assert.IsTrue(signingTool.IsFileSupported(fileName));

                var response = new SignFileResponse();
                var request  = new SignFileRequest
                {
                    FileName           = fileName,
                    OverwriteSignature = true
                };
                signingTool.SignFile(fileName, certificate, ConfigurationManager.AppSettings["TimestampServer"], request, response);

                Trace.WriteLine(response);
                Assert.AreEqual(SignFileResponseResult.FileNotSignedError, response.Result);
                Assert.IsFalse(signingTool.IsFileSigned(fileName));
                Assert.IsInstanceOfType(response.FileContent, typeof(MemoryStream));
                Assert.AreEqual(response.FileSize, response.FileContent.Length);
                Assert.AreEqual(0, response.FileSize);
            }
        }