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");
        }
Ejemplo n.º 3
0
 public ExpectationBuilder(Cardinality cardinality) {
     expectation = new InvocationExpectation(cardinality);
 }
Ejemplo n.º 4
0
 /// <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;
 }
Ejemplo n.º 5
0
 public void ConstrainAsNextInSeq(InvocationExpectation expectation)
 {
     var index = expectationSequence.Count;
     expectationSequence.Add(expectation);
     expectation.AddOrderingConstraint(new InSequenceConstraint(this, index));
 }