public void EatRightExpressionTest()
        {
            // Arrange
            var snapshot = Mock.Of<ISnapshot>();
            var right = Mock.Of<ICSharpExpression>();
            var binaryExpression = Mock.Of<IBinaryExpression>(t => t.RightOperand == right);
            var eater = new Mock<IEater>();
            var binaryExpressionEater = new BinaryExpressionEater(eater.Object);

            // Act
            binaryExpressionEater.Eat(snapshot, binaryExpression);

            // Assert
            eater.Verify(t => t.Eat(snapshot, right), Times.Once);
        }
示例#2
0
        public ExpressionKind RetrunKindTest(ExpressionKind leftKind, ExpressionKind rightKind)
        {
            // Arrange
            var snapshot         = Mock.Of <ISnapshot>();
            var left             = Mock.Of <ICSharpExpression>();
            var right            = Mock.Of <ICSharpExpression>();
            var binaryExpression = Mock.Of <IBinaryExpression>(t => t.LeftOperand == left && t.RightOperand == right);

            var eater = Mock.Of <IEater>(t => t.Eat(snapshot, left) == leftKind &&
                                         t.Eat(snapshot, right) == rightKind);
            var binaryExpressionEater = new BinaryExpressionEater(eater);

            // Assert
            return(binaryExpressionEater.Eat(snapshot, binaryExpression));
        }
示例#3
0
        public void EatRightExpressionTest()
        {
            // Arrange
            var snapshot              = Mock.Of <ISnapshot>();
            var right                 = Mock.Of <ICSharpExpression>();
            var binaryExpression      = Mock.Of <IBinaryExpression>(t => t.RightOperand == right);
            var eater                 = new Mock <IEater>();
            var binaryExpressionEater = new BinaryExpressionEater(eater.Object);

            // Act
            binaryExpressionEater.Eat(snapshot, binaryExpression);

            // Assert
            eater.Verify(t => t.Eat(snapshot, right), Times.Once);
        }
        public void AddRightExpressionToSnapshotTest()
        {
            // Arrange
            var snapshot = new Mock<ISnapshot>();
            var right = Mock.Of<ICSharpExpression>();
            var binaryExpression = Mock.Of<IBinaryExpression>(t => t.RightOperand == right);

            var eater = Mock.Of<IEater>(t => t.Eat(snapshot.Object, right) == ExpressionKind.None);
            var binaryExpressionEater = new BinaryExpressionEater(eater);

            // Act
            binaryExpressionEater.Eat(snapshot.Object, binaryExpression);

            // Assert
            snapshot.Verify(t => t.Add(ExpressionKind.None, right), Times.Once);
        }
示例#5
0
        public void AddRightExpressionToSnapshotTest()
        {
            // Arrange
            var snapshot         = new Mock <ISnapshot>();
            var right            = Mock.Of <ICSharpExpression>();
            var binaryExpression = Mock.Of <IBinaryExpression>(t => t.RightOperand == right);

            var eater = Mock.Of <IEater>(t => t.Eat(snapshot.Object, right) == ExpressionKind.None);
            var binaryExpressionEater = new BinaryExpressionEater(eater);

            // Act
            binaryExpressionEater.Eat(snapshot.Object, binaryExpression);

            // Assert
            snapshot.Verify(t => t.Add(ExpressionKind.None, right), Times.Once);
        }
        public ExpressionKind RetrunKindTest(ExpressionKind leftKind, ExpressionKind rightKind)
        {
            // Arrange
            var snapshot = Mock.Of<ISnapshot>();
            var left = Mock.Of<ICSharpExpression>();
            var right = Mock.Of<ICSharpExpression>();
            var binaryExpression = Mock.Of<IBinaryExpression>(t => t.LeftOperand == left && t.RightOperand == right);

            var eater = Mock.Of<IEater>(t => t.Eat(snapshot, left) == leftKind
                                          && t.Eat(snapshot, right) == rightKind);
            var binaryExpressionEater = new BinaryExpressionEater(eater);

            // Assert
            return binaryExpressionEater.Eat(snapshot, binaryExpression);
        }