public async Task GetSystemInfoTest() { // Arrange var systemInfoResponse = new SystemInfoResponse { OSType = OperatingSystemType, Architecture = Architecture }; var dockerClient = Mock.Of <IDockerClient>( dc => dc.System == Mock.Of <ISystemOperations>(so => so.GetSystemInfoAsync(default(CancellationToken)) == Task.FromResult(systemInfoResponse))); var inputRuntimeInfo = new DockerRuntimeInfo("docker", new DockerRuntimeConfig("1.13", string.Empty)); // Act RuntimeInfoProvider runtimeInfoProvider = await RuntimeInfoProvider.CreateAsync(dockerClient); SystemInfo systemInfo = await runtimeInfoProvider.GetSystemInfo(); // Assert Assert.NotNull(systemInfo); Assert.Equal(systemInfo.OperatingSystemType, systemInfoResponse.OSType); Assert.Equal(systemInfo.Architecture, systemInfoResponse.Architecture); }
public async Task GetSystemInfoTest() { // Arrange var systemInfoSample = new SystemInfo("linux", "x86", "1"); var moduleManager = Mock.Of <IModuleManager>(m => m.GetSystemInfoAsync() == Task.FromResult(systemInfoSample)); IRuntimeInfoProvider runtimeInfoProvider = new RuntimeInfoProvider <TestConfig>(moduleManager); // Act SystemInfo systemInfo = await runtimeInfoProvider.GetSystemInfo(); // Assert Assert.NotNull(systemInfo); Assert.Equal("linux", systemInfo.OperatingSystemType); Assert.Equal("x86", systemInfo.Architecture); Assert.Equal("1", systemInfo.Version); }
public async Task TestPlatformInfo() { using (var cts = new CancellationTokenSource(Timeout)) { // Arrange SystemInfoResponse systemInfo = await Client.System.GetSystemInfoAsync(cts.Token); RuntimeInfoProvider runtimeInfoProvider = await RuntimeInfoProvider.CreateAsync(Client); // Act SystemInfo recivedSystemInfo = await runtimeInfoProvider.GetSystemInfo(); // Assert Assert.Equal(systemInfo.OSType, recivedSystemInfo.OperatingSystemType); Assert.Equal(systemInfo.Architecture, recivedSystemInfo.Architecture); } }