public void TestClose() { var testResults = new TestResults(3, false); var mailbox = new TestMailbox(testResults, World.DefaultLogger); var actor = new CountTakerActor(testResults, World.DefaultLogger); for (var count = 0; count < 3; ++count) { var countParam = count; Action <ICountTaker> consumer = consumerActor => consumerActor.Take(countParam); var message = new LocalMessage <ICountTaker>(actor, consumer, "Take(int)"); mailbox.Send(message); dispatcher.Execute(mailbox); } dispatcher.Close(); Action <ICountTaker> consumer2 = consumerActor => consumerActor.Take(10); var message2 = new LocalMessage <ICountTaker>(actor, consumer2, "Take(int)"); mailbox.Send(message2); dispatcher.Execute(mailbox); var counts = testResults.GetCounts(); Assert.Equal(3, counts.Count); for (var idx = 0; idx < counts.Count; ++idx) { Assert.Contains(idx, counts); } }
public void TestClose() { var testResults = new TestResults(); testResults.Log.Set(true); var mailbox = new TestMailbox(testResults); var actor = new CountTakerActor(testResults); testResults.Until = Until(3); for (var count = 0; count < 3; ++count) { var countParam = count; Action <ICountTaker> consumer = consumerActor => consumerActor.Take(countParam); var message = new LocalMessage <ICountTaker>(actor, consumer, "Take(int)"); mailbox.Send(message); dispatcher.Execute(mailbox); } testResults.Until.Completes(); dispatcher.Close(); Action <ICountTaker> consumer2 = consumerActor => consumerActor.Take(10); var message2 = new LocalMessage <ICountTaker>(actor, consumer2, "Take(int)"); mailbox.Send(message2); dispatcher.Execute(mailbox); Assert.Equal(3, testResults.Counts.Count); for (var idx = 0; idx < testResults.Counts.Count; ++idx) { Assert.Contains(idx, testResults.Counts); } }
public void TestExecute() { var testResults = new TestResults(); testResults.Log.Set(true); var mailbox = new TestMailbox(testResults, World.DefaultLogger); var actor = new CountTakerActor(testResults, World.DefaultLogger); testResults.Until = Until(Total); for (var count = 0; count < Total; ++count) { var countParam = count; Action <ICountTaker> consumer = consumerActor => consumerActor.Take(countParam); var message = new LocalMessage <ICountTaker>(actor, consumer, "Take(int)"); mailbox.Send(message); dispatcher.Execute(mailbox); } testResults.Until.Completes(); for (var idx = 0; idx < testResults.Counts.Count; ++idx) { Assert.Contains(idx, testResults.Counts); } }