public void AttributeBasedPresenterDiscoveryStrategy_GetAttributes_ShouldThrowExceptionForSharedPresenterWithoutExplicitViewType() { var cache = new Dictionary <RuntimeTypeHandle, IEnumerable <PresenterBindingAttribute> >(); var ex = Assert.Throws <NotSupportedException>( () => AttributeBasedPresenterDiscoveryStrategy.GetAttributes(cache, typeof(Host1))); const string expectedMessage = "When a PresenterBindingAttribute is applied with BindingMode=SharedPresenter, the ViewType must be explicitly specified. One of the bindings on WebFormsMvp.UnitTests.Binder.AttributeBasedPresenterDiscoveryStrategyTests.GetAttributes_SharedPresenterWithoutExplicitViewType+Host1 violates this restriction."; Assert.AreEqual(expectedMessage, ex.Message); }
public void AttributeBasedPresenterDiscoveryStrategy_GetAttributes_ShouldDefaultViewTypeToSourceType() { var cache = new Dictionary <RuntimeTypeHandle, IEnumerable <PresenterBindingAttribute> >(); var sourceType = typeof(Host1); var results = AttributeBasedPresenterDiscoveryStrategy.GetAttributes(cache, sourceType); Assert.AreEqual(sourceType, results.Single().ViewType); }