public void TestReleaseLockExceptionNoInstallationId() { NbSsePushReceiveClient client = new NbSsePushReceiveClient(); DeleteStorage(); // インスタレーションIDなしでストレージに保存 SaveInstallationToStorage(false, true); var res = new Mock <HttpWebResponse>(); // Main client.AutoRecovery(HttpStatusCode.Unauthorized, res.Object); Assert.IsFalse(client.AutoRecovery(HttpStatusCode.Unauthorized, res.Object)); // Check ReleaseLock try { // AcquireLock()でExceptionが起きないことを確認 NbSsePushReceiveClient.AcquireLock(); } catch (Exception) { Assert.Fail("Exception"); } NbSsePushReceiveClient.ReleaseLock(); }
public void TestAutoRecoveryNormal() { NbSsePushReceiveClient client = new NbSsePushReceiveClient(); var res = new Mock <HttpWebResponse>(); var responseBody = CreateBody(true, true); var response = new MockRestResponse(HttpStatusCode.OK, responseBody.ToString()); executor.AddResponse(response); // Main client.AutoRecovery(HttpStatusCode.Unauthorized, res.Object); // Check Request CheckRequest(); // ストレージ内のインスタレーション情報存在チェック CheckSaveStorage(); // Check ReleaseLock try { // AcquireLock()でExceptionが起きないことを確認 NbSsePushReceiveClient.AcquireLock(); } catch (Exception) { Assert.Fail("Exception"); } NbSsePushReceiveClient.ReleaseLock(); }
public void TestAutoRecoveryExceptionFailLock() { NbSsePushReceiveClient client = new NbSsePushReceiveClient(); var res = new Mock <HttpWebResponse>(); // ロック状態にする NbSsePushReceiveClient.AcquireLock(); // Main Assert.IsFalse(client.AutoRecovery(HttpStatusCode.Unauthorized, res.Object)); NbSsePushReceiveClient.ReleaseLock(); }