public void Should_be_able_to_handle_a_complete_graph() { // Given var list = new List <Type> { typeof(BootstwapperBase), typeof(DefaultBootstwapper), typeof(MyFirstBootstwapper), typeof(MySecondBootstwapper) }; Type found; // When var res = NancyBootstrapperLocator.TryFindMostDerivedType(list, out found); // Then res.ShouldEqual(true); found.ShouldEqual(typeof(MySecondBootstwapper)); }
public void Should_return_false_when_there_are_more_than_one_most_derived_types() { // Given var list = new List <Type> { typeof(MyFirstBootstwapper), typeof(MySecondBootstwapper), typeof(MyThirdBootstwapper) }; Type found; // When var res = NancyBootstrapperLocator.TryFindMostDerivedType(list, out found); // Then res.ShouldEqual(false); found.ShouldEqual(null); }
public void Should_be_able_to_handle_parent_and_grandparent_inheritance_of_internal_stuff() { // Given var list = new List <Type> { typeof(MyOwnDefaultBootstwapper), typeof(MyFirstBootstwapper) }; Type found; // When var res = NancyBootstrapperLocator.TryFindMostDerivedType(list, out found); // Then res.ShouldEqual(false); found.ShouldEqual(null); }
public void Should_automatically_resolve_the_most_derived_bootstrapper() { // Given var list = new List <Type> { typeof(MyFirstBootstwapper), typeof(MySecondBootstwapper), typeof(MyFourthBootstwapper) }; Type found; // When var res = NancyBootstrapperLocator.TryFindMostDerivedType(list, out found); // Then res.ShouldEqual(true); found.ShouldEqual(typeof(MyFourthBootstwapper)); }