public void TestLockUnlock() { var passphrase = Encoding.UTF8.GetBytes("passphrase"); var agentClient = new TestAgentClient(); /* verify that locking works */ Assert.That(() => agentClient.Lock(passphrase), Throws.Nothing); /* verify that locking already locked agent fails */ Assert.That(() => agentClient.Lock(passphrase), Throws.Exception.TypeOf <AgentFailureException>()); /* verify that unlocking works */ Assert.That(() => agentClient.Unlock(passphrase), Throws.Nothing); /* verify that unlocking already unlocked agent fails */ Assert.That(() => agentClient.Unlock(passphrase), Throws.Exception.TypeOf <AgentFailureException>()); /* try with null passphrase */ Assert.That(() => agentClient.Lock(null), Throws.Nothing); Assert.That(() => agentClient.Unlock(null), Throws.Nothing); /* verify that bad passphrase fails */ Assert.That(() => agentClient.Lock(passphrase), Throws.Nothing); Assert.That(() => agentClient.Unlock(null), Throws.Exception.TypeOf <AgentFailureException>()); }
public void TestLockUnlock() { var passphrase = Encoding.UTF8.GetBytes("passphrase"); var agentClient = new TestAgentClient(); /* verify that locking works */ Assert.That(() => agentClient.Lock(passphrase), Throws.Nothing); /* verify that locking already locked agent fails */ Assert.That(() => agentClient.Lock(passphrase), Throws.Exception.TypeOf<AgentFailureException>()); /* verify that unlocking works */ Assert.That(() => agentClient.Unlock(passphrase), Throws.Nothing); /* verify that unlocking already unlocked agent fails */ Assert.That(() => agentClient.Unlock(passphrase), Throws.Exception.TypeOf<AgentFailureException>()); /* try with null passphrase */ Assert.That(() => agentClient.Lock(null), Throws.Nothing); Assert.That(() => agentClient.Unlock(null), Throws.Nothing); /* verify that bad passphrase fails */ Assert.That(() => agentClient.Lock(passphrase), Throws.Nothing); Assert.That(() => agentClient.Unlock(null), Throws.Exception.TypeOf<AgentFailureException>()); }