Introduce interfaces for IBsonReader/IBsonWriter

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Major - P3
    • 2.0
    • Affects Version/s: 1.9.2
    • Component/s: BSON
    • None
    • Fully Compatible
    • None
    • None
    • None
    • None
    • None
    • None

      To enable easier testing of serializers (along with other benefits), interfaces should be introduced where BsonReader and BsonWriter are currently being used.

      Old

      In order to unit test a custom bson serializers, a mock of BsonReader and BsonWriter need to be provided.

      If the custom serializer depends on the CurrentBsonType or State properties, it can not be tested easily, as these properties are not virtual, and have protected setters.

      There is an ugly workaround to create your own abstract inheritors of the above classes, where one can provide a public method to set these properties, and then for the test to mock that inheritors.

      A better approach would be to make these properties virtual, providing for a better user code testability.

            Assignee:
            Robert Stam
            Reporter:
            Svetoslav Milenov
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: