示例#1
0
        public void AddPointerVariableToSnapshotTest()
        {
            // Arrange
            var snapshot    = new Mock <ISnapshot>();
            var initializer = Mock.Of <IVariableInitializer>();
            var codeFixedPointerDeclaration = Mock.Of <IUnsafeCodeFixedPointerDeclaration>(t => t.Initial == initializer);
            var eater            = Mock.Of <IEater>();
            var initializerEater = Mock.Of <IVariableInitializerEater>(t => t.Eat(snapshot.Object, initializer) == ExpressionKind.Stub);
            var codeFixedPointerDeclarationEater = new UnsafeCodeFixedPointerDeclarationEater(eater, initializerEater);

            // Act
            codeFixedPointerDeclarationEater.Eat(snapshot.Object, codeFixedPointerDeclaration);

            // Assert
            snapshot.Verify(t => t.Add(ExpressionKind.Stub, codeFixedPointerDeclaration), Times.Once);
        }
        public void EatPointerInitializerTest()
        {
            // Arrange
            var snapshot = Mock.Of<ISnapshot>();
            var initializer = Mock.Of<IVariableInitializer>();
            var codeFixedPointerDeclaration = Mock.Of<IUnsafeCodeFixedPointerDeclaration>(t => t.Initial == initializer);
            var eater = Mock.Of<IEater>();
            var initializerEater = new Mock<IVariableInitializerEater>();
            var codeFixedPointerDeclarationEater = new UnsafeCodeFixedPointerDeclarationEater(eater, initializerEater.Object);

            // Act
            codeFixedPointerDeclarationEater.Eat(snapshot, codeFixedPointerDeclaration);

            // Assert
            initializerEater.Verify(t => t.Eat(snapshot, initializer), Times.Once);
        }
示例#3
0
        public void EatPointerInitializerTest()
        {
            // Arrange
            var snapshot    = Mock.Of <ISnapshot>();
            var initializer = Mock.Of <IVariableInitializer>();
            var codeFixedPointerDeclaration = Mock.Of <IUnsafeCodeFixedPointerDeclaration>(t => t.Initial == initializer);
            var eater            = Mock.Of <IEater>();
            var initializerEater = new Mock <IVariableInitializerEater>();
            var codeFixedPointerDeclarationEater = new UnsafeCodeFixedPointerDeclarationEater(eater, initializerEater.Object);

            // Act
            codeFixedPointerDeclarationEater.Eat(snapshot, codeFixedPointerDeclaration);

            // Assert
            initializerEater.Verify(t => t.Eat(snapshot, initializer), Times.Once);
        }
        public void AddPointerVariableToSnapshotTest()
        {
            // Arrange
            var snapshot = new Mock<ISnapshot>();
            var initializer = Mock.Of<IVariableInitializer>();
            var codeFixedPointerDeclaration = Mock.Of<IUnsafeCodeFixedPointerDeclaration>(t => t.Initial == initializer);
            var eater = Mock.Of<IEater>();
            var initializerEater = Mock.Of<IVariableInitializerEater>(t => t.Eat(snapshot.Object, initializer) == ExpressionKind.Stub);
            var codeFixedPointerDeclarationEater = new UnsafeCodeFixedPointerDeclarationEater(eater, initializerEater);

            // Act
            codeFixedPointerDeclarationEater.Eat(snapshot.Object, codeFixedPointerDeclaration);

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