예제 #1
0
        public async Task <SystemInfo> GetSystemInfoAsync()
        {
            using (HttpClient httpClient = HttpClientHelper.GetHttpClient(this.managementUri))
            {
                var edgeletHttpClient = new EdgeletHttpClient(httpClient)
                {
                    BaseUrl = HttpClientHelper.GetBaseUrl(this.managementUri)
                };
                SystemInfo systemInfo = await this.Execute(
                    () => edgeletHttpClient.GetSystemInfoAsync(Constants.EdgeletManagementApiVersion),
                    "Getting System Info");

                return(systemInfo);
            }
        }
        public async Task GetSystemInfoTest()
        {
            // Arrange
            var systemInfoSample = new 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);
        }