Exemplo n.º 1
0
        public void EnvironmentRepositoryClearExpectedDisconnectsAndRemovesAllItems()
        {
            var source = new Mock<IEnvironmentModel>();
            var e1 = new Mock<IEnvironmentModel>();
            e1.Setup(e => e.Disconnect()).Verifiable();
            var e2 = new Mock<IEnvironmentModel>();
            e2.Setup(e => e.Disconnect()).Verifiable();

            var repo = new TestEnvironmentRespository(source.Object, e1.Object, e2.Object);
            Assert.AreEqual(3, repo.All().Count);

            repo.Clear();

            Assert.AreEqual(0, repo.All().Count);
            source.Verify(e => e.Disconnect());
            e1.Verify(e => e.Disconnect());
            e2.Verify(e => e.Disconnect());
        }