public void WhenOverlappingDatesReturnsCaseStatusWithOverlappingDates() { var(caseStatus, person) = CaseStatusHelper.SavePersonWithPastCaseStatusToDatabase(DatabaseContext); var response = _caseStatusGateway.GetClosedCaseStatusesByPersonIdAndDate(caseStatus.PersonId, DateTime.Today.AddDays(-2)); response.Count.Should().Be(1); }
public void WhenMatchingIDAndPastCaseStatusReturnEmptyList() { var(_, person) = CaseStatusHelper.SavePersonWithPastCaseStatusToDatabase(DatabaseContext); var response = _caseStatusGateway.GetActiveCaseStatusesByPersonId(person.Id); response.Should().BeEmpty(); }
public void WhenNoOverlappingDatesNoCaseStatusesReturned() { var(_, person) = CaseStatusHelper.SavePersonWithPastCaseStatusToDatabase(DatabaseContext); var response = _caseStatusGateway.GetClosedCaseStatusesByPersonIdAndDate(person.Id, DateTime.Today); response.Should().BeEmpty(); }
public void CreatesACaseStatusWithoutAnswersShouldPassIfNoOverlappingCaseStatusExists() { var(_, person) = CaseStatusHelper.SavePersonWithPastCaseStatusToDatabase(DatabaseContext); var request = CaseStatusHelper.CreateCaseStatusRequest(personId: person.Id, answers: new List <CaseStatusRequestAnswers>(), startDate: DateTime.Today); _caseStatusGateway.CreateCaseStatus(request); var caseStatus = DatabaseContext.CaseStatuses.OrderByDescending(cs => cs.StartDate).FirstOrDefault(); caseStatus.EndDate.Should().BeNull(); caseStatus.StartDate.Should().Be(DateTime.Today); }