我有一個演員的測試,可能會迴應一些意外的消息,但最終它必須迴應一個特定的已知消息。 因此,在本質我想斷言,這將在一定時間跨度內,忽略其他的消息,但想到一個已知的消息,像這樣:如何使用akka.net測試工具包期望某些消息並忽略其他消息?
[TestMethod]
[TestCategory("Integration")]
public async Task Should_fetch_fund_shareclass_and_details_from_test_service()
{
var testIsins = new HashSet<string> {"isin1", "isin2", "isin3"};
var props = Props.Create(() => new DataFetchSupervisor());
var actor = Sys.ActorOf(props, "fetchSupervisor");
Within(TimeSpan.FromSeconds(30),() =>
{
actor.Tell(new StartDataFetch(testIsins));
//ignore unexpected messages here
var fetchComplteMsg = ExpectMsg<DataFetchComplete>();
});
}
所以,現在,因爲我得到DataFetchComplete消息之前的一些其他的消息,這將失敗。
一如既往,在此先感謝您的幫助。
Ach所以,不知道那個功能。這也是一個非常漂亮的。謝謝,非常感謝。 –