コード例 #1
0
 public void PwEntry()
 {
     Assert.AreEqual(
         String.Empty,
         PwDatabaseUtils.FindEntryByTitle(this.pwDatabase, "Windows host sample", true).Strings.ReadSafe("")
         );
 }
コード例 #2
0
        public void UpdateLastModificationTime(String title, string lastModificationTime)
        {
            // Arrange
            var pwEntry = PwDatabaseUtils.FindEntryByTitle(this.pwDatabase, title, true);

            Assert.IsNotNull(pwEntry);

            var hostPwEntry = new HostPwEntry(pwEntry, this.pwDatabase, fieldMapper);

            Assert.That(hostPwEntry.LastModificationTime.ToUniversalTime(), Is.EqualTo(DateTime.Parse(lastModificationTime).ToUniversalTime()));

            // Act
            var utcNow = DateTime.UtcNow;

            hostPwEntry.LastModificationTime = utcNow;

            // Assert
            Assert.AreEqual(utcNow, hostPwEntry.LastModificationTime.ToUniversalTime());
        }
コード例 #3
0
        public void HostPwEntryGetAdditionalOptionsAssertDoesNotThrow(String title, String additionalOptionsFieldName)
        {
            var fieldsMapper = new InMemoryFieldMapper()
            {
                HostAddress       = "IP Address",
                ConnectionMethod  = "OS",
                AdditionalOptions = additionalOptionsFieldName
            };

            var entry = new HostPwEntry(
                PwDatabaseUtils.FindEntryByTitle(this.pwDatabase, title, true),
                this.pwDatabase,
                fieldsMapper
                );

            String additionalOptions = null;

            Assert.DoesNotThrow(() => additionalOptions = entry.AdditionalOptions);
            Assert.IsNullOrEmpty(additionalOptions);
        }
コード例 #4
0
        public void HostPwEntryWithAndWithoutReferencedFields(String title)
        {
            var expectedConnectionMethods = new Collection <ConnectionMethodType>()
            {
                ConnectionMethodType.PuttySSH,
                ConnectionMethodType.WinSCP
            };

            var entry = new HostPwEntry(
                PwDatabaseUtils.FindEntryByTitle(this.pwDatabase, title, true),
                this.pwDatabase,
                this.fieldsMapper
                );

            Assert.AreEqual("root", entry.GetUsername());
            Assert.AreEqual("123456789", entry.GetPassword());
            Assert.AreEqual("192.168.0.110", entry.IPAddress);
            CollectionAssert.AreEquivalent(expectedConnectionMethods, entry.ConnectionMethods);
            Assert.IsTrue(entry.HasIPAddress);
            Assert.IsTrue(entry.HasConnectionMethods);
        }
コード例 #5
0
        public void HostPwEntry()
        {
            var expectedConnectionMethods = new Collection <ConnectionMethodType>()
            {
                ConnectionMethodType.RemoteDesktop,
                ConnectionMethodType.RemoteDesktopConsole,
            };

            var entry = new HostPwEntry(
                PwDatabaseUtils.FindEntryByTitle(this.pwDatabase, "Windows host sample", true),
                this.pwDatabase,
                this.fieldsMapper
                );

            Assert.AreEqual("Administrator", entry.GetUsername());
            Assert.AreEqual("12345678", entry.GetPassword());
            Assert.AreEqual("192.168.0.100", entry.IPAddress);
            CollectionAssert.AreEquivalent(expectedConnectionMethods, entry.ConnectionMethods);
            Assert.IsTrue(entry.HasIPAddress);
            Assert.IsTrue(entry.HasConnectionMethods);
        }
コード例 #6
0
        public void HostPwEntryGetAdditionalOptionsWithPlaceholders(String title, string expectedAdditionalOptions)
        {
            // Arrange
            var fieldMapper = new InMemoryFieldMapper()
            {
                AdditionalOptions = "Notes"
            };

            // Act
            var entry = new HostPwEntry(
                PwDatabaseUtils.FindEntryByTitle(this.pwDatabase, title, true),
                this.pwDatabase,
                fieldMapper
                );

            // Assert
            String additionalOptions = null;

            Assert.DoesNotThrow(() => additionalOptions = entry.AdditionalOptions);
            Assert.That(additionalOptions, Is.EqualTo(expectedAdditionalOptions));
        }