public async Task GetDetailedCarInfo_CorrectAutoId_ReturnsCorrectDetailedCarInfoObject(int autoId)
        {
            // Act
            DetailedCarInfo detailedCarInfo = await _carService.GetDetailedCarInfo(autoId);

            // Assert
            Assert.True(detailedCarInfo.IsValid());
        }
Beispiel #2
0
        public async Task MapToDetailedCarInfoObject_CorrectJsonStringObject_ReturnsCorrectDetailedCarInfoObject()
        {
            // Arrange
            using (var streamReader = new StreamReader($"{_testFilesFolderPath}allCarInfoTestFile.json"))
            {
                string jsonString = await streamReader.ReadToEndAsync();

                // Act
                DetailedCarInfo detailedCarInfo = _carMapper.MapToDetailedCarInfoObject(jsonString);

                // Assert
                Assert.IsType <DetailedCarInfo>(detailedCarInfo);
                Assert.True(detailedCarInfo.IsValid());
            }
        }
Beispiel #3
0
        public async Task GetDetailedCarInfo_SendsHttpRequestWithCorrectAutoId_ReturnsResponseWithCorrectDetailedCarInfoObject(int autoId)
        {
            // Arrange
            string uri = $"/api/cars/detailed-info/{autoId}";

            // Act
            HttpResponseMessage response = await _httpClient.GetAsync(uri);

            response.EnsureSuccessStatusCode();
            string stringResponse = await response.Content.ReadAsStringAsync();

            DetailedCarInfo detailedCarInfo = JsonConvert.DeserializeObject <DetailedCarInfo>(stringResponse);

            // Assert
            Assert.NotNull(detailedCarInfo);
            Assert.IsType <DetailedCarInfo>(detailedCarInfo);
            Assert.True(detailedCarInfo.IsValid());
        }