private void AssertDescriptionIsEqual(InvocationExpectation expectation, string expected)
        {
            var writer = new StringDescriptionWriter();
            expectation.DescribeActiveExpectationsTo(writer);

            Assert.AreEqual(expected, writer.ToString());
        }
        public void ChecksCallCountToAssertThatItHasBeenMet()
        {
            var expectation = new InvocationExpectation(Cardinality.AtLeast(2));

            AssertHasNotBeenMet(expectation, "should not have been met after no invocations");

            expectation.Perform(invocation);
            AssertHasNotBeenMet(expectation, "should not have been met after 1 invocation");

            expectation.Perform(invocation);
            AssertHasBeenMet(expectation, "should have been met after 2 invocations");

            expectation.Perform(invocation);
            AssertHasBeenMet(expectation, "should have been met after 3 invocations");

            expectation.Perform(invocation);
            AssertHasBeenMet(expectation, "should have been met after 4 invocations");
        }
 public ExpectationBuilder(Cardinality cardinality) {
     expectation = new InvocationExpectation(cardinality);
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="IndexSetterBuilder"/> class.
 /// </summary>
 /// <param name="expectation">The expectation.</param>
 /// <param name="builder">The builder.</param>
 public IndexSetterBuilder(InvocationExpectation expectation, ExpectationBuilder builder) {
     this.expectation = expectation;
     this.builder = builder;
 }
Example #5
0
 public void ConstrainAsNextInSeq(InvocationExpectation expectation)
 {
     var index = expectationSequence.Count;
     expectationSequence.Add(expectation);
     expectation.AddOrderingConstraint(new InSequenceConstraint(this, index));
 }