Ad
  • Custom User Avatar

    Oh, ok, i get it, thank you

  • Custom User Avatar

    You did not fully specify which type of property data types should be included. You should make much more properties in the random tests of the following types. I added remarks because you haven't specified the following:

    • What is a "List" in this kata? (System.Collections.List, System.Collections.Generic.List<>, System.Collections.Generic.IList<>, ...)
    • What is considered an "Implementation" of an interface? (classes, other interfaces, the interface itself, ...)

    Properties that should be ignored by user:

    • List<object>
    • IList<ISearchable> (or is IList also ok?)
    • ISearchable[]

    Properties that should be included by user:

    • List<SomeClassThatImplementsISearchable>
    • List<SomeInterfaceThatIsDerivedFromISearchable> (or is a derived interface not considered an impl of the interface?)
    • List<SomeClassThatImplementsSomeInterfaceThatIsDerivedFromISearchable>
    • List<ISearchable> (or is the interface not considered an impl of itself?)
  • Custom User Avatar

    You should show an example in the sample tests (and random tests) of a List<object> property that contains at least one ISearchable. And tell us how to handle these cases.

  • Custom User Avatar

    This comment is hidden because it contains spoiler information about the solution

  • Custom User Avatar

    No, this has nothing to do with the issue. There is a difference between "a property of type List<ISearchable>" and "a property of type List<object> that contains some List<ISearchable> objects". The tests never distinguish between them, which is problematic.

  • Custom User Avatar

    Sorry, my English is bad,
    I meant that it doesn't matter how you find Lists, the main thing is that the result is output only from those whose arguments implement ISearchable
    I hope the description is clearer now.

  • Custom User Avatar

    the only condition to search DataBase properties is the search is performed only in those Lists in which the Generic Type Argument implements the ISearchable interface

    This is not tested thoroughly: solutions like this will happily take any ISearchable items from a List<object> property and search on them, instead of searching only on List<ISearchable>.

  • Custom User Avatar

    damn, I just realized that I was going through the actual List instead of the expected one.
    Thank you, fixed

  • Custom User Avatar

    NUnit has CollectionAssert.AreEqual; use that instead of trying to compare list equality yourself, because it's currently broken: see this

    (Besides, tests err out if null is returned, which is also problematic. CollectionAssert.AreEqual also handles null gracefully)

  • Custom User Avatar

    So this:
    All Lists are public {get;} properties so the only condition to search DataBase properties is the search is performed only in those Lists in which the Generic Type Argument implements the ISearchable interface

    Allready was in description

  • Custom User Avatar

    done👍

  • Custom User Avatar

    Could use tag: Reflection

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    You can use the third (optional) argument of CollectionAssert.AreEqual to display a proper error message, containing a deep string representation of both expected and actual values.

  • Loading more items...