Skip to content

About

Expectations to verify interactions with mocks from Mockolate.

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

1 watching

Forks

Latest commit

 

History

159 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

aweXpect.Mockolate

Nuget Build Quality Gate Status Coverage Mutation testing badge

Expectations to verify interactions with mocks from Mockolate for aweXpect.

At a glance

IPlayer player = IPlayer.CreateMock();
player.Play("Let It Be");
player.Stop();

// verify how often a method was invoked
await Expect.That(player.Mock.Verify.Play("Let It Be")).Once();

// verify the order of the interactions
await Expect.That(player.Mock.Verify.Play("Let It Be")).Then(m => m.Stop());

// verify that no interaction was forgotten
await Expect.That(player.Mock.Verify).AllInteractionsAreVerified();

A failing verification lists the matching and all interactions with the mock. If the track was played twice, Once() would fail with:

Expected that the MusicStore.IPlayer mock
invoked method Play(Let It Be) exactly once,
but it was found twice

Matching Interactions:
[
  invoke method Play(Let It Be),
  invoke method Play(Let It Be)
]

All Interactions:
[
  invoke method Play(Let It Be),
  invoke method Play(Let It Be)
]

Overview

Expectation Summary
Once, Twice, Never the interaction happened exactly once, twice or never
AtLeastOnce, AtLeastTwice, AtLeast the interaction happened at least the given number of times
AtMostOnce, AtMostTwice, AtMost the interaction happened at most the given number of times
Exactly, Between the interaction happened exactly or in a range of times
Times the number of interactions satisfies a predicate
Then the interactions happened in the given order
AllInteractionsAreVerified every interaction with the mock was verified
AllSetupsAreUsed every setup of the mock was used

Verifications of a minimum number of interactions and of their order can wait for interactions that happen in the background with Within(timeout), see Waiting for interactions and Interaction order.

Documentation

The full documentation is available at docs.testably.org:

About

Expectations to verify interactions with mocks from Mockolate.

Resources

Code of conduct

Contributing

Stars

1 star

Watchers

1 watching

Forks

Releases

Sponsor this project

Contributors

Languages