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?)
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.
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.
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.
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>.
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
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.
Oh, ok, i get it, thank you
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:
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?)You should show an example in the sample tests (and random tests) of a
List<object>
property that contains at least oneISearchable
. And tell us how to handle these cases.This comment is hidden because it contains spoiler information about the solution
No, this has nothing to do with the issue. There is a difference between "a property of type
List<ISearchable>
" and "a property of typeList<object>
that contains someList<ISearchable>
objects". The tests never distinguish between them, which is problematic.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.
This is not tested thoroughly: solutions like this will happily take any
ISearchable
items from aList<object>
property and search on them, instead of searching only onList<ISearchable>
.damn, I just realized that I was going through the actual List instead of the expected one.
Thank you, fixed
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 handlesnull
gracefully)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
done👍
Could use tag:
Reflection
Fixed
Added
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...