コード例 #1
0
        public void Test_Verify_With_One_Func(Expression<Func<ILogWriter, int>> action,
            Expression<Func<ILogWriter, int>> verificationExpression, Times times)
        {
            // Arrange
            var stub = new StubILogWriter();
            var mock = new Mock<ILogWriter>(stub);

            // Act
            action.Compile()(stub);

            // Assert
            mock.Verify(verificationExpression, times);
        }
        public void Test_VerifyAll_With_One_Action(Expression<Action<ILogWriter>> action,
            Expression<Action<ILogWriter>> verificationExpression, Times times)
        {
            // Arrange
            var stub = new StubILogWriter();
            var mock = new Mock<ILogWriter>(stub);

            mock.Setup(verificationExpression, times);
            // Act
            action.Compile()(stub);

            // Assert
            mock.Verify();
        }
コード例 #3
0
 private bool Equals(Times other)
 {
     return Equals(_range, other._range);
 }
        public void Test_Verify_With_Sequence_Of_Actions(
            List<Expression<Action<ILogWriter>>> actions,
            Expression<Action<ILogWriter>> verificationExpression, Times times)
        {
            // Arrange
            var stub = new StubILogWriter();
            var mock = new Mock<ILogWriter>(stub);

            // Act
            foreach (var a in actions)
            {
                a.Compile()(stub);
            }

            // Assert
            mock.Verify(verificationExpression, times);
        }