Ejemplo n.º 1
0
        public void GetCaseStatusByIdReturnsTheAssociatedCaseStatus()
        {
            var(caseStatus, _, _) = CaseStatusHelper.SavePersonWithCaseStatusToDatabase(DatabaseContext);

            var response = _caseStatusGateway.GetCasesStatusByCaseStatusId(caseStatus.Id);

            CaseStatusHelper.TrimMilliseconds(response?.StartDate).Should().Be(CaseStatusHelper.TrimMilliseconds(caseStatus.ToDomain().StartDate));
            CaseStatusHelper.TrimMilliseconds(response?.EndDate).Should().Be(CaseStatusHelper.TrimMilliseconds(caseStatus.ToDomain().EndDate));
            response?.Id.Should().Be(caseStatus.ToDomain().Id);
            response?.Type.Should().Be(caseStatus.ToDomain().Type);

            response?.Answers.Should().BeEquivalentTo(caseStatus.ToDomain().Answers,
                                                      options =>
            {
                options.Using <DateTime>(ctx => ctx.Subject.Should().BeCloseTo(ctx.Expectation, 1000)).WhenTypeIs <DateTime>();
                return(options);
            }
                                                      );
        }
Ejemplo n.º 2
0
        public void WhenMatchingIDReturnsCaseStatuses()
        {
            var(caseStatus, person, answers) = CaseStatusHelper.SavePersonWithCaseStatusToDatabase(DatabaseContext);

            var response = _caseStatusGateway.GetCaseStatusesByPersonId(person.Id);

            response.Count.Should().Be(1);
            var responseElement = response.First();

            CaseStatusHelper.TrimMilliseconds(responseElement.StartDate).Should().Be(CaseStatusHelper.TrimMilliseconds(caseStatus.ToDomain().StartDate));
            CaseStatusHelper.TrimMilliseconds(responseElement.EndDate).Should().Be(CaseStatusHelper.TrimMilliseconds(caseStatus.ToDomain().EndDate));
            responseElement.Id.Should().Be(caseStatus.ToDomain().Id);
            responseElement.Type.Should().Be(caseStatus.ToDomain().Type);
            responseElement.Answers.Count.Should().Be(answers.Count);

            responseElement?.Answers.Should().BeEquivalentTo(caseStatus.ToDomain().Answers,
                                                             options =>
            {
                options.Using <DateTime>(ctx => ctx.Subject.Should().BeCloseTo(ctx.Expectation, 1000)).WhenTypeIs <DateTime>();
                return(options);
            }
                                                             );
        }