public void Setup() { _mockSocket = new MockSocket { Connected = true }; _mockSocket.Expect("use default\r\n", "USING default\r\n"); _mockSocket.Expect("list-tubes-watched\r\n", "OK 16\r\n---\r\n- default\r\n\r\n"); _client = new BeanstalkClient(_mockSocket); }
public void Out_of_memory_response_throws() { _mockSocket.Expect("put 123 0 60 3\r\nfoo\r\n", "OUT_OF_MEMORY\r\n"); var data = "foo".AsStream(); try { _client.Put(0, TimeSpan.Zero, TimeSpan.Zero, data, data.Length); Assert.Fail("didn't throw"); } catch (InvalidStatusException e) { Assert.AreEqual(ResponseStatus.OutOfMemory, e.Status); return; } catch (Exception e) { Assert.Fail(string.Format("threw '{0}' instead of InvalidStatusException", e)); } }