Beispiel #1
0
        public void ReturnStubCandidateTest()
        {
            // Arrange
            var snapshot               = Mock.Of <ISnapshot>();
            var ternaryExpression      = Mock.Of <IConditionalTernaryExpression>();
            var eater                  = Mock.Of <IEater>();
            var ternaryExpressionEater = new ConditionalTernaryExpressionEater(eater);

            // Act
            var kind = ternaryExpressionEater.Eat(snapshot, ternaryExpression);

            // Assert
            Assert.AreEqual(kind, ExpressionKind.StubCandidate);
        }
Beispiel #2
0
        public void EatElseExpressionTest()
        {
            // Arrange
            var snapshot               = Mock.Of <ISnapshot>();
            var elseOperand            = Mock.Of <ICSharpExpression>();
            var ternaryExpression      = Mock.Of <IConditionalTernaryExpression>(t => t.ElseResult == elseOperand);
            var eater                  = new Mock <IEater>();
            var ternaryExpressionEater = new ConditionalTernaryExpressionEater(eater.Object);

            // Act
            ternaryExpressionEater.Eat(snapshot, ternaryExpression);

            // Assert
            eater.Verify(t => t.Eat(snapshot, elseOperand), Times.Once);
        }
        public void EatConditionExpressionTest()
        {
            // Arrange
            var snapshot = Mock.Of<ISnapshot>();
            var condition = Mock.Of<ICSharpExpression>();
            var ternaryExpression = Mock.Of<IConditionalTernaryExpression>(t => t.ConditionOperand == condition);
            var eater = new Mock<IEater>();
            var ternaryExpressionEater = new ConditionalTernaryExpressionEater(eater.Object);

            // Act
            ternaryExpressionEater.Eat(snapshot, ternaryExpression);

            // Assert
            eater.Verify(t => t.Eat(snapshot, condition), Times.Once);
        }
Beispiel #4
0
        public void AddThenExpressionToSnapshotTest()
        {
            // Arrange
            var snapshot          = new Mock <ISnapshot>();
            var then              = Mock.Of <ICSharpExpression>();
            var ternaryExpression = Mock.Of <IConditionalTernaryExpression>(t => t.ThenResult == then);

            var eater = Mock.Of <IEater>(t => t.Eat(snapshot.Object, then) == ExpressionKind.None);
            var ternaryExpressionEater = new ConditionalTernaryExpressionEater(eater);

            // Act
            ternaryExpressionEater.Eat(snapshot.Object, ternaryExpression);

            // Assert
            snapshot.Verify(t => t.Add(ExpressionKind.None, then), Times.Once);
        }
        public void AddThenExpressionToSnapshotTest()
        {
            // Arrange
            var snapshot = new Mock<ISnapshot>();
            var then = Mock.Of<ICSharpExpression>();
            var ternaryExpression = Mock.Of<IConditionalTernaryExpression>(t => t.ThenResult == then);

            var eater = Mock.Of<IEater>(t => t.Eat(snapshot.Object, then) == ExpressionKind.None);
            var ternaryExpressionEater = new ConditionalTernaryExpressionEater(eater);

            // Act
            ternaryExpressionEater.Eat(snapshot.Object, ternaryExpression);

            // Assert
            snapshot.Verify(t => t.Add(ExpressionKind.None, then), Times.Once);
        }
        public void ReturnStubCandidateTest()
        {
            // Arrange
            var snapshot = Mock.Of<ISnapshot>();
            var ternaryExpression = Mock.Of<IConditionalTernaryExpression>();
            var eater = Mock.Of<IEater>();
            var ternaryExpressionEater = new ConditionalTernaryExpressionEater(eater);

            // Act
            var kind = ternaryExpressionEater.Eat(snapshot, ternaryExpression);

            // Assert
            Assert.AreEqual(kind, ExpressionKind.StubCandidate);
        }