本文整理汇总了C#中System.Web.Mvc.ControllerBuilder.GetControllerFactory方法的典型用法代码示例。如果您正苦于以下问题:C# ControllerBuilder.GetControllerFactory方法的具体用法?C# ControllerBuilder.GetControllerFactory怎么用?C# ControllerBuilder.GetControllerFactory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Web.Mvc.ControllerBuilder
的用法示例。
在下文中一共展示了ControllerBuilder.GetControllerFactory方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Should_be_able_to_register_controller_factory
public void Should_be_able_to_register_controller_factory()
{
var builder = new ControllerBuilder();
new RegisterControllerFactory(adapter.Object, builder).Execute();
Assert.Same(controllerFactory.Object, builder.GetControllerFactory());
}
示例2: ControllerBuilderReturnsDefaultControllerBuilderByDefault
public void ControllerBuilderReturnsDefaultControllerBuilderByDefault() {
// Arrange
ControllerBuilder cb = new ControllerBuilder();
// Act
IControllerFactory cf = cb.GetControllerFactory();
// Assert
Assert.IsInstanceOfType(cf, typeof(DefaultControllerFactory));
}
示例3: Should_not_register_controller_factory_when_excluded
public void Should_not_register_controller_factory_when_excluded()
{
RegisterControllerFactory.Excluded = true;
DependencyResolver.SetResolver(null);
var builder = new ControllerBuilder();
new RegisterControllerFactory(adapter.Object, builder).Execute();
Assert.NotSame(controllerFactory.Object, builder.GetControllerFactory());
}
示例4: CreateControllerWithFactoryTypeReturnsValidType
public void CreateControllerWithFactoryTypeReturnsValidType() {
// Arrange
ControllerBuilder cb = new ControllerBuilder();
cb.SetControllerFactory(typeof(MockControllerFactory));
// Act
IControllerFactory cf = cb.GetControllerFactory();
// Assert
Assert.IsInstanceOfType(cf, typeof(MockControllerFactory));
}
示例5: CreateControllerWithFactoryInstanceReturnsInstance
public void CreateControllerWithFactoryInstanceReturnsInstance() {
// Arrange
ControllerBuilder cb = new ControllerBuilder();
DefaultControllerFactory factory = new DefaultControllerFactory();
cb.SetControllerFactory(factory);
// Act
IControllerFactory cf = cb.GetControllerFactory();
// Assert
Assert.AreSame(factory, cf);
}
示例6: ControllerBuilderGetControllerFactoryDelegatesToResolver
public void ControllerBuilderGetControllerFactoryDelegatesToResolver() {
//Arrange
Mock<IControllerFactory> factory = new Mock<IControllerFactory>();
Resolver<IControllerFactory> resolver = new Resolver<IControllerFactory> { Current = factory.Object };
ControllerBuilder builder = new ControllerBuilder(resolver);
//Act
IControllerFactory result = builder.GetControllerFactory();
//Assert
Assert.AreSame(factory.Object, result);
}
示例7: SettingControllerFactoryReturnsSetFactory
public void SettingControllerFactoryReturnsSetFactory() {
// Arrange
ControllerBuilder builder = new ControllerBuilder();
Mock<IControllerFactory> setFactory = new Mock<IControllerFactory>();
// Act
builder.SetControllerFactory(setFactory.Object);
// Assert
Assert.AreSame(setFactory.Object, builder.GetControllerFactory());
}
示例8: DefaultControllerFactoryIsDefaultControllerFactory
public void DefaultControllerFactoryIsDefaultControllerFactory() {
// Arrange
ControllerBuilder builder = new ControllerBuilder();
// Act
IControllerFactory returnedControllerFactory = builder.GetControllerFactory();
//Assert
Assert.AreEqual(typeof(DefaultControllerFactory), returnedControllerFactory.GetType());
}