internal static bool ForceShutdown(IPersistence persistence, IFavorite favorite, ShutdownCommands shutdownCommand) { var guarded = new GuardedSecurity(persistence, favorite.Security); var security = guarded.GetResolvedCredentials(); var credentials = new NetworkCredential(security.UserName, security.Password, security.Domain); return(ForceShutdown(favorite.ServerName, shutdownCommand, credentials) == 0); }
public void SavedPassword_ResolveCredentials_ReturnsSavedPassword() { var guarded = new GuardedSecurity(this.persistenceMock.Object, original); guarded.Password = PASSWORD; var result = guarded.GetResolvedCredentials(); const string MESSAGE = "Localy saved password has always precedence over default password or stored credential."; Assert.AreEqual(original.EncryptedPassword, result.EncryptedPassword, MESSAGE); }
public void ValidParams_ResolveCredentials_ReturnsNotOriginalInstance() { var guarded = new GuardedSecurity(this.persistenceMock.Object, original); var result = guarded.GetResolvedCredentials(); result.Password = "******"; const string MESSAGE = "Changing the resolved instance password cant affect the original. We return new instance."; Assert.AreNotEqual(original.EncryptedPassword, result.EncryptedPassword, MESSAGE); }
private IGuardedSecurity ResolveCredentials(ISecurityOptions original) { var guarded = new GuardedSecurity(this.persistenceMock.Object, original); return(guarded.GetResolvedCredentials()); }