コード例 #1
0
ファイル: SystemTests.cs プロジェクト: dk0104/promitor
        public async Task System_GetInfo_ReturnsOk()
        {
            // Arrange
            var expectedVersion         = Configuration["Agents:ResourceDiscovery:Expectations:Version"];
            var resourceDiscoveryClient = new ResourceDiscoveryClient(Configuration, Logger);

            // Act
            var response = await resourceDiscoveryClient.GetSystemInfoAsync();

            // Assert
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            var rawPayload = await response.Content.ReadAsStringAsync();

            Assert.NotEmpty(rawPayload);
            var systemInfo = JsonConvert.DeserializeObject <SystemInfo>(rawPayload);

            Assert.NotNull(systemInfo);
            Assert.Equal(expectedVersion, systemInfo.Version);
        }
コード例 #2
0
        public async Task System_GetInfo_ReturnsOk()
        {
            // Arrange
            var resourceDiscoveryClient = new ResourceDiscoveryClient(Configuration, Logger);

            // Act
            var response = await resourceDiscoveryClient.GetSystemInfoAsync();

            // Assert
            Assert.Equal(HttpStatusCode.OK, response.StatusCode);
            var rawPayload = await response.Content.ReadAsStringAsync();

            Assert.NotEmpty(rawPayload);
            var systemInfo = JsonConvert.DeserializeObject <SystemInfo>(rawPayload);

            Assert.NotNull(systemInfo);
            Assert.Equal(ExpectedVersion, systemInfo.Version);
            Assert.True(response.Headers.Contains(HttpHeaders.AgentVersion));
            Assert.Equal(ExpectedVersion, response.Headers.GetFirstOrDefaultHeaderValue(HttpHeaders.AgentVersion));
        }