public void Test_Connection() { fDb.DeleteDatabase(); Assert.IsFalse(fDb.IsExists); Assert.IsFalse(fDb.IsConnected); fDb.Connect(); Assert.IsTrue(fDb.IsConnected); Assert.Throws(typeof(DatabaseException), () => { fDb.Connect(); }); // already connected fDb.Disconnect(); Assert.IsFalse(fDb.IsConnected); Assert.Throws(typeof(DatabaseException), () => { fDb.Disconnect(); }); // already disconnected Assert.IsTrue(fDb.IsExists); }
protected override void Dispose(bool disposing) { if (disposing) { fDHTClient.PeersFound -= OnPeersFound; fDHTClient.PeerPinged -= OnPeerPinged; fDHTClient.QueryReceived -= OnQueryReceive; fDHTClient.ResponseReceived -= OnResponseReceive; fTCPClient.DataReceive -= OnDataReceive; fDatabase.Disconnect(); } base.Dispose(disposing); }