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


C# Computer.PreloadAgg方法代码示例

本文整理汇总了C#中Computer.PreloadAgg方法的典型用法代码示例。如果您正苦于以下问题:C# Computer.PreloadAgg方法的具体用法?C# Computer.PreloadAgg怎么用?C# Computer.PreloadAgg使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Computer的用法示例。


在下文中一共展示了Computer.PreloadAgg方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Preload_test

        public void Preload_test()
        {
            // arrange
            var maker = "Intel";
            var processorSpeed = 500;
            var ramSize = 2000;
            processors[0] = new Dictionary<string, object>
            {
                { "Maker", maker},
                { "Speed", processorSpeed},
                { "RamId", 0 }
            };
            rams[0] = new Dictionary<string, object>
            {
                { "Size", ramSize }
            };
            var aggregatorProvider = aggregatorProviderMock.Object;
            var processorModel = new ProcessorModel(0, processorCollectionMock.Object);
            var ramModel = new RAMModel(0, ramCollectionMock.Object);
            var computer = new Computer(aggregatorProvider, processorModel);
            var ram = new RAM(aggregatorProvider, ramModel);
            aggregatorProvider.Save(computer, ram);

            // act
            computer.PreloadAgg(x => x.Maker,
                                x => x.ProcessorSpeed,
                                x => x.RAM);

            // assert
            computer.RAM.Size.Should().Be(ramSize);
            computer.ProcessorSpeed.Should().Be(processorSpeed);
            computer.Maker.Should().Be(maker);
            processorCollectionMock.Verify(x =>
                x.GetFields(It.IsAny<Id>(), It.IsAny<string[]>()),
                Times.Once);
            processorCollectionMock.Verify(x =>
                x.GetModelField(It.IsAny<Id>(), It.IsAny<string>()),
                Times.Never);
            ramCollectionMock.Verify(x =>
                x.GetFields(It.IsAny<Id>(), It.IsAny<string[]>()),
                Times.Once);
            ramCollectionMock.Verify(x =>
                x.GetModelField(It.IsAny<Id>(), It.IsAny<string>()),
                Times.Never);
        }
开发者ID:iroq,项目名称:trellis,代码行数:45,代码来源:NestedLazyAggregatorTests.cs

示例2: Preload_test

        public void Preload_test()
        {
            // arrange
            var maker = "Intel";
            var processorSpeed = 500;
            var ramSize = 2000;
            processors[0] = new Dictionary<string, object>
            {
                { "Maker", maker},
                { "Speed", processorSpeed}
            };
            rams[0] = new Dictionary<string, object>
            {
                { "Size", ramSize }
            };
            var processor = new Processor(0, processorCollectionMock.Object);
            var ram = new RAM(0, ramCollectionMock.Object);
            var computer = new Computer(aggregatorProviderMock.Object, processor, ram);

            // act
            computer.PreloadAgg(x => x.Maker,
                                x => x.ProcessorSpeed,
                                x => x.RAMSize);

            // assert
            var sth = computer.Maker;
            var sth2 = computer.Maker;
            var sth3 = computer.Maker;
            computer.Maker.Should().Be(maker);
            computer.ProcessorSpeed.Should().Be(processorSpeed);
            computer.RAMSize.Should().Be(ramSize);

            processorCollectionMock.Verify(x =>
                x.GetFields(It.IsAny<Id>(), It.IsAny<string[]>()),
                Times.Once());
            ramCollectionMock.Verify(x =>
                x.GetFields(It.IsAny<Id>(), It.IsAny<string[]>()),
                Times.Once());
        }
开发者ID:iroq,项目名称:trellis,代码行数:39,代码来源:LazyAggregatorTests.cs


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