예제 #1
0
        public void SessionImpl_Raises_OperationInvalidException_If_Connection_Is_Broken_On_Open()
        {
            var fixture = new PersistenceAdapterFixture();

            fixture.ConnectionMock.Setup(c => c.State).Returns(ConnectionState.Broken);

            using (var session = new SessionImpl(fixture.Connection))
                AssertRaise <InvalidOperationException>(() => { session.Open(); });
        }
예제 #2
0
        public void SessionImpl_Can_Be_Opened()
        {
            var fixture = new PersistenceAdapterFixture();

            fixture.ConnectionMock.Setup(c => c.State).Returns(ConnectionState.Closed);

            using (var session = new SessionImpl(fixture.Connection))
                session.Open();

            fixture.ConnectionMock.Verify(c => c.Open());
        }