コード例 #1
0
        public async Task CreateNewApplicationReturnsResponse()
        {
            // Arrange
            var request = _applicationFixture.ConstructCreateApplicationRequest();
            var json    = JsonConvert.SerializeObject(request);

            // Act
            var response = await PostTestRequestAsync(json).ConfigureAwait(false);

            response.StatusCode.Should().Be(HttpStatusCode.Created);

            var responseContent = await response.Content.ReadAsStringAsync().ConfigureAwait(false);

            var apiEntity = JsonConvert.DeserializeObject <ApplicationResponse>(responseContent);

            // Assert
            apiEntity.Should().NotBeNull();
            apiEntity.Id.Should().NotBeEmpty();
            apiEntity.Status.Should().Be(request.Status);
            apiEntity.CreatedAt.Should().BeCloseTo(DateTime.UtcNow, 5000);
            apiEntity.MainApplicant.Should().BeEquivalentTo(request.MainApplicant);
            apiEntity.OtherMembers.Should().BeEquivalentTo(request.OtherMembers);
        }