コード例 #1
0
        public void TestForeachRule()
        {
            // Arrange
            const int count      = 10;
            var       subject    = new HashSet <T>(RandomValues.Values <T>(count));
            var       mockAction = new Mock <IInvokeDelegate>();
            var       rule       = Rule.CreateForeach(Rule.Create <T>(mockAction.Object.Action));

            // Act
            rule.Process(subject);

            // Assert
            foreach (var item in subject)
            {
                var item1 = item;
                mockAction.Verify(a => a.Action(item1), Times.Once());
            }
        }