public void GivenNoParagraphs_ThrowsMissingMethodException() { var section = new InterpretationSectionBuilder() .SetTitle(string.Empty); Assert.Throws <MissingMethodException>(() => section.Build()); }
public void BuildWithoutPreBuildValidation_GivenNoTitleOrParagraphs_Succeeds() { var section = InterpretationSectionBuilder.Initialize() .BuildWithoutModelValidation(); Assert.IsType <InterpretationSection>(section); }
private InterpretationSection Section2() { return(InterpretationSectionBuilder.Initialize() .SetTitle("Section2 Title") .AddParagraph("Section 2 Paragraph 1") .AddParagraph("Section 2 Paragraph 2") .Build()); }
public void Build_WithoutTitle_ThrowsMissingMethodException() { var builder = InterpretationTextBuilder.Initialize() .SetSummary("Summary") .AddSection(InterpretationSectionBuilder.Initialize().BuildWithoutModelValidation()); Assert.Throws <MissingMethodException>(() => builder.Build()); }
public void BuildWithoutPreBuildValidation_GivenEmptyTitle_Succeeds() { var section = InterpretationSectionBuilder.Initialize() .SetTitle(string.Empty) .AddParagraph("Paragraph") .BuildWithoutModelValidation(); Assert.IsType <InterpretationSection>(section); }
public void GivenNullOrEmptyTitle_ThrowsArgumentOutOfRangeException() { var section = InterpretationSectionBuilder.Initialize() .SetTitle(string.Empty) .AddParagraph(string.Empty) .BuildWithoutModelValidation(); Assert.Throws <ArgumentOutOfRangeException>(() => InterpretationText.Build(string.Empty, string.Empty, new List <InterpretationSection> { section })); }
public void Build_WithTitleAndSection_Suceeds() { var builder = InterpretationTextBuilder.Initialize() .SetTitle("Tite") .AddSection(InterpretationSectionBuilder.Initialize() .AddParagraph("Paragraph") .BuildWithoutModelValidation()); var text = builder.Build(); Assert.IsType <InterpretationText>(text); }
public void ToString_ContainsTitle() { var section = InterpretationSectionBuilder.Initialize() .AddParagraph(string.Empty) .SetTitle(string.Empty) .BuildWithoutModelValidation(); var interp = new InterpretationTextBuilder() .SetTitle("Title") .SetSummary(string.Empty) .AddSection(section) .Build(); Assert.Contains("Title", interp.ToString()); }
public void InterpretationSectionWithThreeParagraphs_ReturnsParagraphsInOrder() { var section = new InterpretationSectionBuilder() .SetTitle("Title") .AddParagraph("one") .AddParagraph("two") .AddParagraph("three") .Build(); var paragraphOfInterest = section.Paragraphs.Where(p => p.Contains("three")); Assert.True(paragraphOfInterest.Any()); Assert.Equal(3, section.Paragraphs.Count); }
private InterpretationSection BuildMakingChangesSection() { var section = new InterpretationSectionBuilder() .SetTitle("Making Changes") .AddParagraph("Making changes for blood pressure consists primary of lifestyle and medical " + "interventions. Lifestyle interventions include improving body composition, " + "such as reducing body fat percentage to an ideal level, increasing cardiovascular " + "training, and making dietary changes. A common diet prescribed for hypertension " + "is the DASH diet. When lifestyle is not enough, we include blood pressure " + "medications. We understand that people often wish to avoid medications"); if (_stage == BloodPressureStage.Low) { return(section.AddParagraph("Your blood pressure is low. This case is less simple to generalize. " + "As such, it's importnat to discuss the details of this in the context of " + "your overall state of health with your clinician.").Build()); } if (_stage == BloodPressureStage.Elevated) { return(section.AddParagraph( "Your blood pressure is elevated to a range that is most often addressable " + "via lifestyle change. Some combination of bodyfat reduction, exercise, and " + "dietary changes such as those described in the DASH diet, will likely " + "remedy this.").Build()); } if (_stage == BloodPressureStage.Stage1Hypertension) { return(section.AddParagraph( "Your blood pressure is elevated to a range that is sometimes addressable " + "by lifestyle change, but often requires medication. It's reasonable to " + "have a discussion with your clinician on whether or not lifestyle change " + "is a good option for your before adding medication, or if both are " + "necessary at this point.").Build()); } if (_stage == BloodPressureStage.Stage2Hypertension) { return(section.AddParagraph( "Your blood pressure is elevated to a range that requires medical management. " + "It is still possible to reduce the blood pressure via lifestyle to a degree that the " + "medication can be stopped. However, while this is a possibility, the " + "current levels are such that they should be addressed. ").Build()); } if (_stage == BloodPressureStage.HypertensiveUrgency) { return(section.AddParagraph("Your blood pressure is elevated to such a degree that action is urgent. " + "Medications are required, and it often takes as many as three medications " + "to reduce blood pressure that is this elevated to an acceptable level. " + "Improving blood pressure via medical management should be very high priority " + "and working closely with your clinician to accomplish this in a relatively " + "short period of time is strongly encouraged.").Build()); } if (_stage == BloodPressureStage.HypertensiveEmergency) { return(section.AddParagraph( "Your blood pressure needs to be addressed emergently. There is evidence to " + "suggest that the blood pressure elevation is causing acute, dangerous " + "damage to organs of your body. This cannot be delayed. ").Build()); } return(section.Build()); }