示例#1
0
        public async Task GetSystemInfoTest()
        {
            // Arrange
            var systemInfoSample = new GeneratedCode.SystemInfo();

            systemInfoSample.OsType       = "linux";
            systemInfoSample.Architecture = "x86";

            var moduleManager = Mock.Of <IModuleManager>(m => m.GetSystemInfoAsync() == Task.FromResult(systemInfoSample));
            IRuntimeInfoProvider runtimeInfoProvider = new RuntimeInfoProvider <TestConfig>(moduleManager);

            // Act
            Core.SystemInfo systemInfo = await runtimeInfoProvider.GetSystemInfo();

            // Assert
            Assert.NotNull(systemInfo);
            Assert.Equal("linux", systemInfo.OperatingSystemType);
            Assert.Equal("x86", systemInfo.Architecture);
        }
示例#2
0
        private static uint GetPUserKData()
        {
            uint PUserKData = 0;

            Core.SystemInfo si = Core.GetSystemInfo();

            switch (si.ProcessorArchitecture)
            {
            case Core.ProcessorArchitecture.ARM:
                PUserKData = PUserKDataARM;
                break;

            //the "x86" constant is for all non-arm architectures so removed exception throw
            default:
                //case Core.ProcessorArchitecture.Intel:
                PUserKData = PUserKDataX86;
                break;

                //throw new NotSupportedException("Unsupported on current processor: " + EnumEx.GetName(typeof(Core.ProcessorArchitecture), si.wProcessorArchitecture));
            }

            return(PUserKData);
        }