public void VerifyVerifiesAllBehaviorExpectations()
        {
            // Arrange
            var observedCommands = new List <IGuardClauseCommand>();
            var expectations     = Enumerable.Repeat(new DelegatingBehaviorExpectation {
                OnVerify = observedCommands.Add
            }, 3).ToArray();
            var sut = new CompositeBehaviorExpectation(expectations);

            var cmd = new DelegatingGuardClauseCommand();

            // Act
            sut.Verify(cmd);
            // Assert
            Assert.Equal(expectations.Length, observedCommands.Count(c => cmd.Equals(c)));
        }
Exemplo n.º 2
0
        public void VerifyVerifiesAllBehaviorExpectations()
        {
            // Fixture setup
            var observedCommands = new List <IGuardClauseCommand>();
            var expectations     = Enumerable.Repeat(new DelegatingBehaviorExpectation {
                OnVerify = observedCommands.Add
            }, 3).ToArray();
            var sut = new CompositeBehaviorExpectation(expectations);

            var cmd = new DelegatingGuardClauseCommand();

            // Exercise system
            sut.Verify(cmd);
            // Verify outcome
            Assert.Equal(expectations.Length, observedCommands.Count(c => cmd.Equals(c)));
            // Teardown
        }