コード例 #1
0
ファイル: TestExplicitLoad.cs プロジェクト: EBassie/Potato
        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);
        }
コード例 #2
0
ファイル: TestVariableLoad.cs プロジェクト: EBassie/Potato
        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);
        }
コード例 #3
0
ファイル: TestVariableLoad.cs プロジェクト: EBassie/Potato
        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);
        }
コード例 #4
0
ファイル: TestVariableLoad.cs プロジェクト: EBassie/Potato
        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);
        }
コード例 #5
0
ファイル: TestVariableLoad.cs プロジェクト: EBassie/Potato
 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);
 }
コード例 #6
0
ファイル: TestVariableLoad.cs プロジェクト: EBassie/Potato
        public void TestFileDoesNotExist() {
            var certificate = new CertificateController();

            Assert.IsFalse(certificate.Load(Path.Combine(Defines.BaseDirectory.FullName, "Remote", "Certificates", "DoesNotExist.pfx")));
            Assert.IsNull(certificate.Certificate);
        }
コード例 #7
0
ファイル: TestVariableLoad.cs プロジェクト: EBassie/Potato
        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);
        }