예제 #1
0
        public void NullSnapshotTest()
        {
            // Arrange
            var argumentsEater = new ArgumentsEater(Mock.Of <IEater>());

            // Assert
            Assert.Throws <ArgumentNullException>(() => argumentsEater.Eat(null, new TreeNodeCollection <ICSharpArgument>(new ICSharpArgument[0])));
        }
예제 #2
0
        public void NotAddToSnapshotStubCandidateArgumentsTest()
        {
            // Arrange
            var expression     = Mock.Of <ICSharpExpression>();
            var argument       = Mock.Of <ICSharpArgument>(t => t.Value == expression);
            var args           = new TreeNodeCollection <ICSharpArgument>(new[] { argument });
            var snapshot       = new Mock <ISnapshot>();
            var eater          = Mock.Of <IEater>(t => t.Eat(snapshot.Object, expression) == ExpressionKind.StubCandidate);
            var argumentsEater = new ArgumentsEater(eater);

            // Act
            argumentsEater.Eat(snapshot.Object, args);

            // Assert
            snapshot.Verify(t => t.Add(It.IsAny <ExpressionKind>(), argument), Times.Never);
        }
예제 #3
0
        public void AddArgumentToSnapshotTest()
        {
            // Arrange
            var expression     = Mock.Of <ICSharpExpression>();
            var argument       = Mock.Of <ICSharpArgument>(t => t.Value == expression);
            var args           = new TreeNodeCollection <ICSharpArgument>(new[] { argument });
            var snapshot       = new Mock <ISnapshot>();
            var eater          = Mock.Of <IEater>(t => t.Eat(snapshot.Object, expression) == ExpressionKind.Stub);
            var argumentsEater = new ArgumentsEater(eater);

            // Act
            argumentsEater.Eat(snapshot.Object, args);

            // Assert
            snapshot.Verify(t => t.Add(ExpressionKind.Stub, argument), Times.Once);
        }
예제 #4
0
        public void EatArgumentsTest()
        {
            // Arrange
            var expression     = Mock.Of <ICSharpExpression>();
            var mockRep        = new MockRepository(MockBehavior.Default);
            var args           = new  TreeNodeCollection <ICSharpArgument>(mockRep.Of <ICSharpArgument>().Where(t => t.Value == expression).Take(10).ToArray());
            var snapshot       = Mock.Of <ISnapshot>();
            var eater          = new Mock <IEater>();
            var argumentsEater = new ArgumentsEater(eater.Object);

            // Act
            argumentsEater.Eat(snapshot, args);

            // Assert
            eater.Verify(t => t.Eat(snapshot, expression), Times.Exactly(10));
        }