Unit testing serialization pre-membase
hey folks,
I've recently come across a problem with a complex domain object where it's no longer being cached by membase, and I can't (looking through all the properties/sub properties) see a good reason for it not caching - other objects are, so there isn't a server problem.
What I'd love to do with my code is write simple unit tests against each of my objects that I plan to use within membase to ensure that they *are* serializable, and if not, the test fails with the 'why not'.
I'm using the default transcoder.
At the moment I have:
[Test]
public void MyUser_ShouldBeSerializable()
{
MyUser user = new MyUser();
MemoryStream mem = new MemoryStream();
BinaryFormatter b = new BinaryFormatter();
try
{
b.Serialize(mem, user);
}
catch (Exception ex)
{
Assert.Fail(ex.Message);
}
}
now according to this, it serializes fine (the test passes) so I guess membase (and the enyim client) aren't using the binary formatter to serialize the object.
Can anyone shed any light on what type of serialization I should be testing against to ensure I'm testing my objects against the default transcoder/serializer within membase?
Many thanks,
Terry
Sorry for the delay Terry, I've got one of our .NET developers looking into this as we speak.
The client does use the binary serializer (see https://github.com/enyim/EnyimMemcached/blob/master/Enyim.Caching/Memcac...)
Questions:
- What's the return value of Store, when you try to put your object into the cache?
- Can you enable logging to see what's going on in the client? (https://github.com/enyim/EnyimMemcached/wiki/Configure-Logging)
I've added a question on stackoverflow in an attempt to get some feedback if anyone has any:
http://stackoverflow.com/questions/6068741/unit-testing-serialization-of...