OrleansContrib / OrleansTestKit

Unit Test Toolkit for Microsoft Orleans
http://dotnet.github.io/orleans
MIT License
78 stars 43 forks source link

Added test for creating and mocking multiple grain probes #103

Closed freever closed 3 years ago

freever commented 3 years ago

Resolves #101

It turns out there is already a test for a simple probe factory case, so I added one for the more complicated case where multiple grains are created, and probes need to be set up for each of them to return a value based on the id they actually end up being created with by the grain under test.

PS I extended the existing Ping/Pong test classes rather than creating new ones - can redo if required.

seniorquico commented 3 years ago

Looks fine to me, and I'm glad this ended up being simple enough to find a workable solution.

As far as bolting into an existing test suite versus creating a new one... I believe the ping/pong test suite was meant to be the most basic, a great place for someone new to the test kit to take a first look. Do the additional WhatsMyIdResults property and CreateAndPingMultiple & WhatsMyId methods change that story? If yes, it may be worth setting up a new test suite, possibly with a domain model that better describes when & why you might want to use this more complex configuration (e.g. in ping pong stories, there are usually only two parties... not 3 or more). I'm good either way, though.

freever commented 3 years ago

@seniorquico Fair point.

I've refactored so that Ping and Pong remain simple and the test uses a different fit-for-purpose grain.

I left the test itself with all the other GrainProbeTests