本文整理汇总了C#中Factory.InstantiateClientScripts方法的典型用法代码示例。如果您正苦于以下问题:C# Factory.InstantiateClientScripts方法的具体用法?C# Factory.InstantiateClientScripts怎么用?C# Factory.InstantiateClientScripts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Factory
的用法示例。
在下文中一共展示了Factory.InstantiateClientScripts方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LeverageConfigurationWhenCreatingDiscoverableCollection
public void LeverageConfigurationWhenCreatingDiscoverableCollection()
{
var path = @"c:\Windows";
var config = new Section {ClientScripts = {DiscoveryLocation = path, AutoDiscover = false}};
var locatorMock = new Mock<IServiceLocator>();
locatorMock.Setup(l => l.GetAllInstances<IClientScript>()).Returns<ICollection<IClientScript>>(null);
var factory = new Factory(locatorMock.Object){Configuration = config};
var result = factory.InstantiateClientScripts();
var discoverableCollection = result as IDiscoverableCollection<IClientScript>;
Assert.Equal(path, discoverableCollection.DiscoveryLocation);
}
示例2: UseUserLocatorFirstForAllInstances
public void UseUserLocatorFirstForAllInstances()
{
var scripts = new List<IClientScript>();
var userLocatorMock = new Mock<IServiceLocator>();
userLocatorMock.Setup(ul => ul.GetAllInstances<IClientScript>()).Returns(scripts);
var providerLocatorMock = new Mock<IServiceLocator>();
var factory = new Factory(providerLocatorMock.Object, userLocatorMock.Object);
factory.InstantiateClientScripts();
userLocatorMock.Verify(ul => ul.GetAllInstances<IClientScript>(), Times.Once());
providerLocatorMock.Verify(pl => pl.GetAllInstances<IClientScript>(), Times.Never());
}
示例3: InstantiateClientScripts
public void InstantiateClientScripts()
{
var factory = new Factory();
var result = factory.InstantiateClientScripts();
Assert.True(result.Any());
}
示例4: CascadeFromUserLocatorToProviderLocatorForAllInstance
public void CascadeFromUserLocatorToProviderLocatorForAllInstance()
{
var sequence = 0;
var scripts = new List<IClientScript>();
var userLocatorMock = new Mock<IServiceLocator>();
userLocatorMock.Setup(ul => ul.GetAllInstances<IClientScript>()).Returns<ICollection<IClientScript>>(null).Callback(() => Assert.Equal(0, sequence++));
var providerLocatorMock = new Mock<IServiceLocator>();
providerLocatorMock.Setup(pl => pl.GetAllInstances<IClientScript>()).Returns(scripts).Callback(() => Assert.Equal(1, sequence++));
var factory = new Factory(providerLocatorMock.Object, userLocatorMock.Object);
factory.InstantiateClientScripts();
userLocatorMock.Verify(ul => ul.GetAllInstances<IClientScript>(), Times.Once());
providerLocatorMock.Verify(pl => pl.GetAllInstances<IClientScript>(), Times.Once());
}
示例5: InstantiateClientScriptsLeveragesIServiceLocator
public void InstantiateClientScriptsLeveragesIServiceLocator()
{
var clientScripts = new List<IClientScript>();
var serviceLocatorMock = new Mock<IServiceLocator>();
serviceLocatorMock.Setup(sl => sl.GetAllInstances<IClientScript>()).Returns(clientScripts);
var factory = new Factory(serviceLocatorMock.Object);
var result = factory.InstantiateClientScripts();
Assert.Equal(clientScripts, result);
}