private static void ExecuteAndAssert <T>(T expected, MethodCall <T> methodCall) { Assert.Equal(expected, methodCall.Execute(mockServiceLocator)); var methodToJson = methodCall.ToJson(); var methodFromJson = MethodCall <T> .FromJson(methodToJson); Assert.Equal(expected, methodFromJson.Execute(mockServiceLocator)); var newtonJson = JsonConvert.SerializeObject(methodCall); var newtonMethod = JsonConvert.DeserializeObject <MethodCall <T> >(newtonJson); Assert.Equal(expected, newtonMethod.Execute(mockServiceLocator)); }