コード例 #1
0
        public void GetPropertyWithAlerts(int propertyAlertCount, int personAlertCount, bool canRaiseRepair)
        {
            // Arrange
            var legacyReferenceValue = new Faker().Random.String2(10) + "/01";

            var assetResponse  = GenerateAssetResponse(canRaiseRepair);
            var tenureResponse = GenerateTenure(canRaiseRepair, legacyReferenceValue);

            MockApiGateway.SetAssetApiResponse(assetResponse);

            MockApiGateway.SetTenureInformationApiResponse(tenureResponse);

            MockApiGateway.AddPropertyAlerts(propertyAlertCount, assetResponse.AssetId);
            MockApiGateway.AddPersonAlerts(personAlertCount, legacyReferenceValue);
            MockApiGateway.AddResidentContacts();

            ApiGateway client = new ApiGateway(new HttpClientFactoryWrapper(Client));

            // Act
            var response = client.ExecuteRequest <PropertyResponse>("dummy", new Uri($"/api/v2/properties/{assetResponse.AssetId}", UriKind.Relative)).Result;

            // Assert
            response.IsSuccess.Should().BeTrue();
            response.Status.Should().Be(HttpStatusCode.OK);

            response.Content.Property.Should().BeEquivalentTo(assetResponse.ToDomain().ToResponse(tenureResponse.ToDomain()));
            response.Content.Alerts.LocationAlert.Should().HaveCount(propertyAlertCount);
            response.Content.Alerts.PersonAlert.Should().HaveCount(personAlertCount);
            response.Content.Property.CanRaiseRepair.Should().Be(canRaiseRepair);
        }
コード例 #2
0
        public void GetAlerts(int expectedPropertyAlertCount, int expectedPersonAlertCount)
        {
            // Arrange
            var legacyReferenceValue = new Faker().Random.String2(10) + "/01";
            var tenureResponse       = GenerateTenure(legacyReferenceValue);

            var expectedProperty = _fixture.Create <AssetResponseObject>();

            expectedProperty.Tenure.Id = tenureResponse.Id.ToString();

            MockApiGateway.SetAssetApiResponse(expectedProperty);

            MockApiGateway.SetTenureInformationApiResponse(tenureResponse);

            MockApiGateway.AddPropertyAlerts(expectedPropertyAlertCount, expectedProperty.AssetId);
            MockApiGateway.AddTenantInformation(legacyReferenceValue, expectedProperty.AssetId);
            MockApiGateway.AddPersonAlerts(expectedPersonAlertCount, legacyReferenceValue);

            ApiGateway client = new ApiGateway(new HttpClientFactoryWrapper(Client));

            // Act
            var response = client.ExecuteRequest <CautionaryAlertResponseList>("dummy", new Uri($"/api/v2/properties/{expectedProperty.AssetId}/alerts", UriKind.Relative)).Result;

            // Assert
            response.IsSuccess.Should().BeTrue();
            response.Status.Should().Be(HttpStatusCode.OK);
            response.Content.PropertyReference.Should().Be(expectedProperty.AssetId);
            response.Content.LocationAlert.Should().HaveCount(expectedPropertyAlertCount);
            response.Content.PersonAlert.Should().HaveCount(expectedPersonAlertCount);
        }