Index: Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.cs =================================================================== diff -u -r1e3c315bdc13747be481c2e6c9523aa8c3b93ac6 -r9f1e95f305bbc982a11f7a8917a95bf6caa18544 --- Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.cs (.../RichTextBoxControl.cs) (revision 1e3c315bdc13747be481c2e6c9523aa8c3b93ac6) +++ Core/Common/src/Core.Common.Controls/TextEditor/RichTextBoxControl.cs (.../RichTextBoxControl.cs) (revision 9f1e95f305bbc982a11f7a8917a95bf6caa18544) @@ -21,6 +21,8 @@ using System; using System.Drawing; +using System.IO; +using System.Text; using System.Windows.Forms; namespace Core.Common.Controls.TextEditor @@ -46,7 +48,7 @@ richTextBox.KeyDown += OnKeyDown; } - public override string Text + public string Rtf { get { Index: Core/Common/test/Core.Common.Controls.Test/TextEditor/RichTextBoxControlTest.cs =================================================================== diff -u -r1e3c315bdc13747be481c2e6c9523aa8c3b93ac6 -r9f1e95f305bbc982a11f7a8917a95bf6caa18544 --- Core/Common/test/Core.Common.Controls.Test/TextEditor/RichTextBoxControlTest.cs (.../RichTextBoxControlTest.cs) (revision 1e3c315bdc13747be481c2e6c9523aa8c3b93ac6) +++ Core/Common/test/Core.Common.Controls.Test/TextEditor/RichTextBoxControlTest.cs (.../RichTextBoxControlTest.cs) (revision 9f1e95f305bbc982a11f7a8917a95bf6caa18544) @@ -21,17 +21,17 @@ } [Test] - public void Text_ValueSet_ReturnsValue() + public void Data_ValueSet_TextAsExpected() { // Setup - var data = ""; + var data = ""; var control = new RichTextBoxControl(); // Call - control.Text = data; + control.Rtf = GetValidRtfString(data); // Assert - Assert.AreEqual(data, control.Text); + Assert.AreEqual(data, control.Controls[0].Text); } [Test] @@ -171,5 +171,15 @@ Assert.AreEqual(italic, richTextBox.SelectionFont.Italic); } } + + private static string GetValidRtfString(string value) + { + RichTextBox richTextBox = new RichTextBox + { + Text = value + }; + + return richTextBox.Rtf; + } } } \ No newline at end of file Index: Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.cs =================================================================== diff -u -r883c1c27b5590d21a05a293a74206dc45e203cee -r9f1e95f305bbc982a11f7a8917a95bf6caa18544 --- Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.cs (.../AssessmentSectionCommentView.cs) (revision 883c1c27b5590d21a05a293a74206dc45e203cee) +++ Ringtoets/Integration/src/Ringtoets.Integration.Forms/Views/AssessmentSectionCommentView.cs (.../AssessmentSectionCommentView.cs) (revision 9f1e95f305bbc982a11f7a8917a95bf6caa18544) @@ -57,7 +57,7 @@ if (data != null) { - richTextEditor.Text = data.Comments; + richTextEditor.Rtf = data.Comments; } } } @@ -75,7 +75,7 @@ private void RichTextEditorOnTextChanged(object sender, EventArgs eventArgs) { - data.Comments = richTextEditor.Text; + data.Comments = richTextEditor.Rtf; } } } \ No newline at end of file Index: Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionCommentViewTest.cs =================================================================== diff -u -r883c1c27b5590d21a05a293a74206dc45e203cee -r9f1e95f305bbc982a11f7a8917a95bf6caa18544 --- Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionCommentViewTest.cs (.../AssessmentSectionCommentViewTest.cs) (revision 883c1c27b5590d21a05a293a74206dc45e203cee) +++ Ringtoets/Integration/test/Ringtoets.Integration.Forms.Test/Views/AssessmentSectionCommentViewTest.cs (.../AssessmentSectionCommentViewTest.cs) (revision 9f1e95f305bbc982a11f7a8917a95bf6caa18544) @@ -79,22 +79,34 @@ } [Test] + [RequiresSTA] public void Data_AssessmentSectionContainsComment_CommentSetOnRichTextEditor() { // Setup - var expectedText = ""; + var expectedText = ""; var mocks = new MockRepository(); var view = new AssessmentSectionCommentView(); - var data = mocks.StrictMock(); - data.Expect(d => d.Comments).Return(expectedText); + var data = mocks.Stub(); + data.Comments = GetValidRtfString(expectedText); mocks.ReplayAll(); // Call view.Data = data; // Assert - Assert.AreEqual(expectedText, view.Controls[0].Text); + var textBoxControl = view.Controls[0].Controls[0]; + Assert.AreEqual(expectedText, textBoxControl.Text); } + + private static string GetValidRtfString(string value) + { + RichTextBox richTextBox = new RichTextBox + { + Text = value + }; + + return richTextBox.Rtf; + } } } \ No newline at end of file