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


C# IPlatform.Stub方法代码示例

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


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

示例1: Given_ArchitectureStub

 private void Given_ArchitectureStub()
 {
     arch = mr.DynamicMock<IProcessorArchitecture>();
     platform = mr.DynamicMock<IPlatform>();
     platform.Stub(p => p.PointerType).Return(PrimitiveType.Pointer32);
     this.procSer = mr.StrictMock<ProcedureSerializer>(null, null, null);
     platform.Stub(p => p.CreateProcedureSerializer(null, null)).IgnoreArguments().Return(procSer);
     platform.Stub(p => p.Architecture).Return(arch);
 }
开发者ID:relaxar,项目名称:reko,代码行数:9,代码来源:TypeLibraryDeserializerTests.cs

示例2: Setup

 public void Setup()
 {
     mr = new MockRepository();
     programHeaders = new List<Elf64_PHdr>();
     sections = new List<ElfSection>();
     platform = mr.Stub<IPlatform>();
     this.sc = new ServiceContainer();
     var cfgSvc = mr.Stub<IConfigurationService>();
     var arch = mr.Stub<IProcessorArchitecture>();
     platform.Stub(p => p.MakeAddressFromLinear(0))
         .IgnoreArguments()
         .Do(new Func<ulong, Address>(u => Address.Ptr64(u)));
     cfgSvc.Stub(c => c.GetArchitecture("x86-protected-64")).Return(arch);
     sc.AddService<IConfigurationService>(cfgSvc);
 }
开发者ID:uxmal,项目名称:reko,代码行数:15,代码来源:ElfLoader64Tests.cs

示例3: CreatePlatform

        public IPlatform CreatePlatform()
        {
            if (platform != null)
                return platform;

            platform = mr.Stub<IPlatform>();

            platform.Stub(p => p.Name).Return("TestPlatform");
            platform.Stub(p => p.PointerType).Return(PrimitiveType.Pointer32);
            platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Char)).Return(1);
            platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Short)).Return(2);
            platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Int)).Return(4);
            platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Long)).Return(4);
            platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.LongLong)).Return(8);
            platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Float)).Return(4);
            platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Double)).Return(8);
            platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.LongDouble)).Return(8);
            platform.Stub(p => p.GetByteSizeFromCBasicType(CBasicType.Int64)).Return(8);
            platform.Stub(p => p.CreateMetadata()).Do(new Func<TypeLibrary>(() => this.platformMetadata.Clone()));
            var arch = new X86ArchitectureFlat32();
            platform.Stub(p => p.Architecture).Return(arch);
            platform.Stub(p => p.DefaultCallingConvention).Return("__cdecl");

            platform.Stub(s => s.CreateProcedureSerializer(null, null)).IgnoreArguments().Do(
                new Func<ISerializedTypeVisitor<DataType>, string, ProcedureSerializer>((tlDeser, dc) =>
                    new X86ProcedureSerializer(arch, tlDeser, dc)
                )
            );
            platform.Stub(p => p.SaveUserOptions()).Return(null);

            platform.Replay();
            return platform;
        }
开发者ID:gitter-badger,项目名称:reko,代码行数:33,代码来源:MockFactory.cs

示例4: Given_Platform

 private void Given_Platform()
 {
     platform = mr.Stub<IPlatform>();
     platform.Stub(p => p.LookupProcedureByName("", "")).IgnoreArguments().Return(new ExternalProcedure("", null));
     platform.Replay();
 }
开发者ID:relaxar,项目名称:reko,代码行数:6,代码来源:X86EmulatorTests.cs

示例5: Given_Msdos_ish_platform

 private void Given_Msdos_ish_platform()
 {
     this.platform = mr.Stub<IPlatform>();
     platform.Stub(p => p.GetPrimitiveTypeName(PrimitiveType.Int16, "C")).Return("int");
     platform.Stub(p => p.GetPrimitiveTypeName(PrimitiveType.Int32, "C")).Return("long");
 }
开发者ID:relaxar,项目名称:reko,代码行数:6,代码来源:CTypeReferenceFormatterTests.cs


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