本文整理汇总了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);
}
示例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());
}