public void Invalid_Type_Throws_CastException()
        {
            // Arrange
            var session = new MySession1();

            // Act
            var underlyingSession = new UnderlyingSession(session);

            // Assert
            Assert.Throws <InvalidCastException>(() => underlyingSession.Get <MySession2>());
        }
        public void Expected_Type_Is_Accepted()
        {
            // Arrange
            var session = new MySession1();

            // Act
            var underlyingSession = new UnderlyingSession(session);

            // Assert
            Assert.NotNull(underlyingSession.Get <MySession1>());
            Assert.Equal(session, underlyingSession.Get <MySession1>());
        }
        public void Inherited_Types_Are_Accepted()
        {
            // Arrange
            var session1 = new MySession1();
            var session2 = new MySession2();

            // Act
            var underlyingSession1 = new UnderlyingSession(session1);
            var underlyingSession2 = new UnderlyingSession(session2);

            // Assert
            Assert.NotNull(underlyingSession1.Get <MySession1>());
            Assert.NotNull(underlyingSession2.Get <MySession2>());
            Assert.NotNull(underlyingSession2.Get <MySession1>());

            Assert.Equal(session1, underlyingSession1.Get <MySession1>());
            Assert.Equal(session2, underlyingSession2.Get <MySession2>());

            Assert.Equal(session2, underlyingSession2.Get <MySession1>());
            Assert.NotEqual(session1, underlyingSession2.Get <MySession1>());
        }