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


C# Computer.Commit方法代码示例

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


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

示例1: Set_test

        public void Set_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
            var newRamSize = 1;
            computer.RAMSize = newRamSize;
            computer.Commit();

            // assert
            rams[0]["Size"].Should().Be(newRamSize);
        }
开发者ID:iroq,项目名称:trellis,代码行数:27,代码来源:LazyAggregatorTests.cs

示例2: Set_test

        public void Set_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
            var newMaker = "AMD";
            var newProcessorSpeed = 1000;
            var newRamSize = 3000;
            computer.RAM.Size = newRamSize;
            computer.ProcessorSpeed = newProcessorSpeed;
            computer.Maker = newMaker;
            computer.Commit();

            // assert
            processors[0]["Maker"].Should().Be(newMaker);
            processors[0]["Speed"].Should().Be(newProcessorSpeed);
            rams[0]["Size"].Should().Be(newRamSize);
            processorCollectionMock.Verify(x =>
                x.UpdateFields(It.IsAny<Id>(), It.IsAny<IDictionary<string, object>>()),
                Times.Once);
            ramCollectionMock.Verify(x =>
                x.UpdateFields(It.IsAny<Id>(), It.IsAny<IDictionary<string, object>>()),
                Times.Once);
        }
开发者ID:iroq,项目名称:trellis,代码行数:43,代码来源:NestedLazyAggregatorTests.cs


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