The following will evalute to true if the method
SendToTarget is getting called with a type of
// Arrange var osmMock = new Mock<OrderStateMachine>(MockBehavior.Strict, mapper, sessionId, repo); osmMock.Setup(m => m.SendToTarget(It.IsAny<Message>())).Returns(true); var osm = osmMock.Object; // Act // ... // Assert osmMock.Verify(m => m.SendToTarget(It.IsAny<Message>()), Times.Once);
I would like to test that the method
SendToTarget was called with an instance of
Message having set a specific property to a specific value.
Sure I could pass an instance of
Message to the method like this
osmMock.Verify(m => m.SendToTarget(It.Is(myMessageInstance))). But I don't want to verfiy against a completely propagated instance of
All I want is to verify that a specific property of the
Message type is set to a specific value. I hope it's clear what I am trying to archive. How can this be done?