本文整理汇总了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);
}
示例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);
}
示例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;
}
示例4: Given_Platform
private void Given_Platform()
{
platform = mr.Stub<IPlatform>();
platform.Stub(p => p.LookupProcedureByName("", "")).IgnoreArguments().Return(new ExternalProcedure("", null));
platform.Replay();
}
示例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");
}