[BsonSerializer(typeof (BsonPrettyTimeSpanSerializer) )]
public TimeSpan ChunkStartAge { get; private set; }
I would like to write some Unit tests for this, but I am struggling to determine how. I was looking at the Version Tests in C# repo;
var version = BsonSerializer.Deserialize< Version>(json);
I am trying to achieve this as such:
var result = BsonSerializer.Deserialize< TimeSpan>(json);
I am concerned, however, that if I have another serializer registered for TimeSpan, it may not select the correct one for my test.
What I would effectively like to know, is how to Deserialize a string with a pre-determined Serializer. How can I achieve this?
Minor update - the Serializer takes a string in format "1d 2h" and converts it to a TimeSpan, and vice versa
댓글 없음:
댓글 쓰기