public async Task Moudle2MoudleMessagesForwarded() { var twinHandler = Mock.Of <ITwinHandler>(); var m2mHandler = Mock.Of <IModuleToModuleMessageHandler>(); var c2dHandler = Mock.Of <ICloud2DeviceMessageHandler>(); var directMethodHandler = Mock.Of <IDirectMethodHandler>(); var identity = new DeviceIdentity("hub", "device_id"); var input = "input"; var message = new EdgeMessage.Builder(new byte[0]).Build(); Mock.Get(m2mHandler) .Setup(h => h.SendModuleToModuleMessageAsync(It.Is <IMessage>(m => m == message), It.Is <string>(s => s == input), It.Is <IIdentity>(i => i == identity))) .Returns(Task.CompletedTask); var sut = new DeviceProxy(identity, twinHandler, m2mHandler, c2dHandler, directMethodHandler); await sut.SendMessageAsync(message, input); Mock.Get(directMethodHandler).VerifyAll(); }