public void AllShouldContainClientAfterAdd() { AppConnectedClientRepository <TestConnectedClient> repo = new AppConnectedClientRepository <TestConnectedClient>(); TestConnectedClient expected = new TestConnectedClient { OtherProp = "foobar" }; repo.Add(expected); IList <TestConnectedClient> actual = repo.All(); Assert.IsTrue(actual.Any(c => c.Id == expected.Id)); }
public void SingleShouldReturnClientAfterAdd() { AppConnectedClientRepository <TestConnectedClient> repo = new AppConnectedClientRepository <TestConnectedClient>(); TestConnectedClient expected = new TestConnectedClient { OtherProp = "foobar" }; repo.Add(expected); TestConnectedClient actual = repo.Single(expected.Id); Assert.IsNotNull(actual); Assert.AreEqual(expected.Id, actual.Id); Assert.AreEqual(expected.OtherProp, actual.OtherProp); }
public void SingleShouldNotReturnClientAfterRemove() { AppConnectedClientRepository <TestConnectedClient> repo = new AppConnectedClientRepository <TestConnectedClient>(); TestConnectedClient expected = new TestConnectedClient { OtherProp = "foobar" }; repo.Add(expected); TestConnectedClient actual = repo.Single(expected.Id); Assert.IsNotNull(actual); repo.Remove(expected.Id); actual = repo.Single(expected.Id); Assert.IsNull(actual); }
public void ClientShouldNotBeInRepoAfterRemoveReceiver() { var repo = new AppConnectedClientRepository <MsmqConnectedClient>(); MsmqConnectedClient subject = new MsmqConnectedClient { Id = Guid.NewGuid() }; repo.Add(subject); using (MsmqMessageHubService testSvc = new MsmqMessageHubService(@".\private$\testSvc", repo)) { testSvc.RemoveReceiver(subject.Id); MsmqConnectedClient actual = repo.Single(subject.Id); Assert.IsNull(actual); } subject.Dispose(); }