当前位置: 首页>>代码示例>>C#>>正文


C# Factory.InstantiateClientScripts方法代码示例

本文整理汇总了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);
        }
开发者ID:GitObjects,项目名称:Glimpse,代码行数:16,代码来源:FactoryShould.cs

示例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());
        }
开发者ID:GitObjects,项目名称:Glimpse,代码行数:14,代码来源:FactoryShould.cs

示例3: InstantiateClientScripts

 public void InstantiateClientScripts()
 {
     var factory = new Factory();
     var result = factory.InstantiateClientScripts();
     Assert.True(result.Any());
 }
开发者ID:GitObjects,项目名称:Glimpse,代码行数:6,代码来源:FactoryShould.cs

示例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());
        }
开发者ID:GitObjects,项目名称:Glimpse,代码行数:16,代码来源:FactoryShould.cs

示例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);
        }
开发者ID:GitObjects,项目名称:Glimpse,代码行数:13,代码来源:FactoryShould.cs


注:本文中的Factory.InstantiateClientScripts方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。