Esempio n. 1
0
        public void TestNoPassword() {
            var variables = new VariableController();
            var certificate = new CertificateController() {
                Shared = {
                    Variables = variables
                }
            };

            variables.Variable(CommonVariableNames.CommandServerCertificatePath).Value = Path.Combine(Defines.BaseDirectory.FullName, "Remote", "Certificates", "NoPassword.pfx");

            certificate.Execute();

            Assert.IsNotNull(certificate.Certificate);
            Assert.IsNotNull(certificate.Certificate.PrivateKey);
        }
Esempio n. 2
0
        public void TestEventLoggedOnFileDoesNotExist() {
            var events = new EventsController();
            var certificate = new CertificateController() {
                Shared = {
                    Events = events
                }
            };

            Assert.IsFalse(certificate.Load(Path.Combine(Defines.BaseDirectory.FullName, "Remote", "Certificates", "DoesNotExist.pfx")));
            Assert.IsNotEmpty(events.LoggedEvents);
            Assert.IsFalse(events.LoggedEvents.First(e => e.Name == GenericEventType.CommandServerStarted.ToString()).Success);
        }
Esempio n. 3
0
        public void TestPasswordButIncorrectPasswordSupplied() {
            var certificate = new CertificateController();

            Assert.IsFalse(certificate.Load(Path.Combine(Defines.BaseDirectory.FullName, "Remote", "Certificates", "Password.pfx"), "incorrect password"));
            Assert.IsNull(certificate.Certificate);
        }
Esempio n. 4
0
        public void TestPassword() {
            var certificate = new CertificateController();

            Assert.IsTrue(certificate.Load(Path.Combine(Defines.BaseDirectory.FullName, "Remote", "Certificates", "Password.pfx"), "password1"));
            Assert.IsNotNull(certificate.Certificate.PrivateKey);
        }
Esempio n. 5
0
 public void TestNoPasswordButPasswordSupplied() {
     var certificate = new CertificateController();
     
     Assert.IsFalse(certificate.Load(Path.Combine(Defines.BaseDirectory.FullName, "Remote", "Certificates", "NoPassword.pfx"), "This is a password that isn't needed"));
     Assert.IsNull(certificate.Certificate);
 }
Esempio n. 6
0
        public void TestFileDoesNotExist() {
            var certificate = new CertificateController();

            Assert.IsFalse(certificate.Load(Path.Combine(Defines.BaseDirectory.FullName, "Remote", "Certificates", "DoesNotExist.pfx")));
            Assert.IsNull(certificate.Certificate);
        }
Esempio n. 7
0
        public void TestEventLoggedOnNoPasswordButPasswordSupplied() {
            var events = new EventsController();
            var certificate = new CertificateController() {
                Shared = {
                    Events = events
                }
            };

            Assert.IsFalse(certificate.Load(Path.Combine(Defines.BaseDirectory.FullName, "Remote", "Certificates", "NoPassword.pfx"), "This is a password that isn't needed"));
            Assert.IsNotEmpty(events.LoggedEvents);
            Assert.IsFalse(events.LoggedEvents.First(e => e.Name == GenericEventType.CommandServerStarted.ToString()).Success);
        }