public void ShouldSupportIXunitSerializable() { var sut = new TestDataObject(_testObject); Assert.IsAssignableFrom <IXunitSerializable>(sut); object receivedObject = null; var mockXUnitSerializer = new Mock <IXunitSerializationInfo>(); mockXUnitSerializer .Setup(x => x.AddValue(It.IsAny <string>(), It.IsAny <object>(), It.IsAny <Type>())) .Callback((string key, object @object, Type type) => { receivedObject = @object; }); // Serializes the json representation sut.Serialize(mockXUnitSerializer.Object); Assert.Equal(sut.TestObject, receivedObject); // Invokes the GetValue on XUnit for deserialization. sut.Deserialize(mockXUnitSerializer.Object); mockXUnitSerializer.Verify(x => x.GetValue <string>(It.IsAny <string>()), Times.Once); }