private string GetFormattedEventTypeAndOutcome()
        {
            var eventAndValue = new StringBuilder();

            if (TreatmentEventType == null)
            {
                return(eventAndValue.ToString());
            }
            eventAndValue.Append(TreatmentEventType.GetDisplayName());

            if (TreatmentOutcome == null)
            {
                return(eventAndValue.ToString());
            }
            eventAndValue.Append($" - {TreatmentOutcome.TreatmentOutcomeType.GetDisplayName()}");

            return(eventAndValue.ToString());
        }
Beispiel #2
0
        public void IsEpisodeEndingTreatmentEvent_CorrectlyIdentifiesEndingEvents
            (TreatmentEventType eventType, TreatmentOutcomeType?outcomeType, TreatmentOutcomeSubType?subType, bool expectedEnding)
        {
            // Arrange
            var possibleEndingEvent = new TreatmentEvent
            {
                TreatmentEventType = eventType,
                TreatmentOutcome   = outcomeType.HasValue
                    ? new TreatmentOutcome {
                    TreatmentOutcomeType    = outcomeType.Value,
                    TreatmentOutcomeSubType = subType
                }
                    : null
            };

            // Act
            var isEnding = possibleEndingEvent.IsEpisodeEndingTreatmentEvent();

            // Assert
            Assert.Equal(expectedEnding, isEnding);
        }
Beispiel #3
0
        public async Task GetTreatmentEvents_AddsStartingEvent_ForDraftNotification(int notificationId,
                                                                                    TreatmentEventType expectedEventType,
                                                                                    string expectedDate)
        {
            // Arrange
            var url = GetCurrentPathForId(notificationId);

            // Act
            var document = await GetDocumentForUrlAsync(url);

            // Assert
            var treatmentTable = document.QuerySelector("#treatment-events");

            Assert.NotNull(treatmentTable);

            var treatmentOutcomeRow = treatmentTable.QuerySelector("#treatment-event-0");

            Assert.NotNull(treatmentOutcomeRow);
            var treatmentOutcomeTextContent = treatmentOutcomeRow.TextContent;

            // Will not duplicate check for date rendering
            Assert.Contains(expectedEventType.GetDisplayName(), treatmentOutcomeTextContent);
            Assert.Contains(expectedDate, treatmentOutcomeTextContent);
        }