Closed ISkomorokh closed 7 years ago
What's the purpose?
I'm writing a test which needs to check that WebSocketSession.Send(message)
was called with correct data. This method is called withing JsonSubCommand<TWebSocketSession, TJsonCommandInfo>.SendJsonMessage
by calling session.Send(GetJsonMessage(session, name, content));
So, I can mock session.send
because it is virtual, but before calling send GetJsonMessage
is called which is not virtual so I can't stub/mock it.
Also this would allow me to pass settings to serialization method to use camelCase with properties names.
var serializedObject = JsonConvert.SerializeObject(content, new JsonSerializerSettings
{
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
Hi Kerry Jiang!
Could you make JsonSubCommandBase.GetJsonMessage virtual? It would be easier to mock it.
Thanks.