public void DontSendMesssageTest() { IMessageBus messageBus = new SimpleMessageBus(); IFakeHost host = GetFakeHostMocked(messageBus); host.Init(messageBus); Mock.Assert(() => host.OnMessageOneReceived(Arg.IsAny <Message>()), Occurs.Never()); Mock.Assert(() => host.OnMessageOneReceivedExtended(Arg.IsAny <Message>()), Occurs.Never()); Mock.Assert(() => host.OnMessageTwoReceived(Arg.IsAny <Message>()), Occurs.Never()); }
public void SendUnknownMesssageTest() { IMessageBus messageBus = new SimpleMessageBus(); IFakeHost host = GetFakeHostMocked(messageBus); host.Init(messageBus); messageBus.SendMessage(MESSAGE_UNKNOWN, this, MessageActionType.Add); Mock.Assert(() => host.OnMessageOneReceived(Arg.IsAny <Message>()), Occurs.Never()); Mock.Assert(() => host.OnMessageOneReceivedExtended(Arg.IsAny <Message>()), Occurs.Never()); Mock.Assert(() => host.OnMessageTwoReceived(Arg.IsAny <Message>()), Occurs.Never()); }
public void SendTwoMesssagesTest() { IMessageBus messageBus = new SimpleMessageBus(); IFakeHost host = GetFakeHostMocked(messageBus); host.Init(messageBus); messageBus.SendMessage(MESSAGE_STRING, this, MessageActionType.Add); messageBus.SendMessage(MESSAGE_INT, this, MessageActionType.Add); Mock.Assert(() => host.OnMessageOneReceived(Arg.IsAny <Message>()), Occurs.Once()); Mock.Assert(() => host.OnMessageOneReceivedExtended(Arg.IsAny <Message>()), Occurs.Exactly(2)); Mock.Assert(() => host.OnMessageTwoReceived(Arg.IsAny <Message>()), Occurs.Once()); }