public void PwEntry() { Assert.AreEqual( String.Empty, PwDatabaseUtils.FindEntryByTitle(this.pwDatabase, "Windows host sample", true).Strings.ReadSafe("") ); }
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()); }
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); }
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); }
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); }
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)); }