public void EatExceptionTest()
        {
            // Arrange
            var snapshot = Mock.Of<ISnapshot>();
            var exception = Mock.Of<ICSharpExpression>();
            var throwStatement = Mock.Of<IThrowStatement>(t => t.Exception == exception);
            var eater = new Mock<IEater>();
            var throwStatementEater = new ThrowStatementEater(eater.Object);

            // Act
            throwStatementEater.Eat(snapshot, throwStatement);

            // Assert
            eater.Verify(t => t.Eat(snapshot, exception), Times.Once);
        }
Ejemplo n.º 2
0
        public void EatExceptionTest()
        {
            // Arrange
            var snapshot            = Mock.Of <ISnapshot>();
            var exception           = Mock.Of <ICSharpExpression>();
            var throwStatement      = Mock.Of <IThrowStatement>(t => t.Exception == exception);
            var eater               = new Mock <IEater>();
            var throwStatementEater = new ThrowStatementEater(eater.Object);

            // Act
            throwStatementEater.Eat(snapshot, throwStatement);

            // Assert
            eater.Verify(t => t.Eat(snapshot, exception), Times.Once);
        }
Ejemplo n.º 3
0
        public void AddExceptionToSnapshotTest()
        {
            // Arrange
            var snapshot       = new Mock <ISnapshot>();
            var exception      = Mock.Of <ICSharpExpression>();
            var throwStatement = Mock.Of <IThrowStatement>(t => t.Exception == exception);

            var eater = Mock.Of <IEater>(t => t.Eat(snapshot.Object, exception) == ExpressionKind.None);
            var throwStatementEater = new ThrowStatementEater(eater);

            // Act
            throwStatementEater.Eat(snapshot.Object, throwStatement);

            // Assert
            snapshot.Verify(t => t.Add(ExpressionKind.None, exception), Times.Once);
        }
        public void AddExceptionToSnapshotTest()
        {
            // Arrange
            var snapshot = new Mock<ISnapshot>();
            var exception = Mock.Of<ICSharpExpression>();
            var throwStatement = Mock.Of<IThrowStatement>(t => t.Exception == exception);

            var eater = Mock.Of<IEater>(t => t.Eat(snapshot.Object, exception) == ExpressionKind.None);
            var throwStatementEater = new ThrowStatementEater(eater);

            // Act
            throwStatementEater.Eat(snapshot.Object, throwStatement);

            // Assert
            snapshot.Verify(t => t.Add(ExpressionKind.None, exception), Times.Once);
        }