From 42dee7d38a552f401b3003119ba36bb5dd9cef57 Mon Sep 17 00:00:00 2001 From: Niklas Stich <32730297+niklasstich@users.noreply.github.com> Date: Wed, 13 Dec 2023 15:20:02 +0100 Subject: [PATCH] Fixed broken tests --- .../Adaptivity/AdaptivityQuestionPreviewUt.cs | 56 +++--- .../Dialogues/AdaptivityContentDialogIt.cs | 13 +- .../Dialogues/AdaptivityQuestionDialogIt.cs | 10 +- .../CreateEditCommentActionDialogIt.cs | 44 ++--- .../CreateEditReferenceActionDialogIt.cs | 59 +++--- .../MultipleChoiceQuestionFormIt.cs | 74 +++---- IntegrationTest/Forms/GridSelectIt.cs | 44 +++-- .../AdaptivityQuestionPreview.razor | 46 ++--- .../MultipleChoiceQuestionForm.razor | 184 +++++++++--------- .../Components/Forms/GridSelect.razor | 42 ++-- .../LearningWorld/LearningWorldPresenterUt.cs | 12 +- 11 files changed, 294 insertions(+), 290 deletions(-) diff --git a/IntegrationTest/Components/Adaptivity/AdaptivityQuestionPreviewUt.cs b/IntegrationTest/Components/Adaptivity/AdaptivityQuestionPreviewUt.cs index 2500aea77..d6dd99b16 100644 --- a/IntegrationTest/Components/Adaptivity/AdaptivityQuestionPreviewUt.cs +++ b/IntegrationTest/Components/Adaptivity/AdaptivityQuestionPreviewUt.cs @@ -47,7 +47,7 @@ public void Render_Difficulty_RenderPreviewHeader([Values] QuestionDifficulty ex var sut = GetRenderedComponent(adaptivityQuestion); - var header = sut.Find("h5"); + var header = sut.Find("p"); Assert.That(header.InnerHtml, Is.EqualTo("AdaptivityQuestionPreview.Header.Question." + expectedDifficulty)); } @@ -60,7 +60,7 @@ public void Render_MultipleChoiceQuestions_RenderQuestionText() var sut = GetRenderedComponent(adaptivityQuestion); - var questionText = sut.Find("p.mud-typography-body1"); + var questionText = sut.FindAll("p.mud-typography-body1")[1]; Assert.That(questionText.InnerHtml, Is.EqualTo(expectedQuestionText)); } @@ -72,12 +72,12 @@ public void Render_Choices_RenderChoicesText([Values] bool hideChoices) var expectedChoice2Text = "choice2"; var choice1 = ViewModelProvider.GetChoice(expectedChoice1Text); var choice2 = ViewModelProvider.GetChoice(expectedChoice2Text); - adaptivityQuestion.Choices.Returns(new List {choice1, choice2}); - adaptivityQuestion.CorrectChoices.Returns(new List {choice1}); + adaptivityQuestion.Choices.Returns(new List { choice1, choice2 }); + adaptivityQuestion.CorrectChoices.Returns(new List { choice1 }); var sut = GetRenderedComponent(adaptivityQuestion, hideChoices); - var choices = sut.FindAll("p.mud-typography-body2"); + var choices = sut.FindAll("p.mud-typography-body1.choice"); if (hideChoices) { Assert.That(choices, Is.Empty); @@ -100,12 +100,12 @@ public void Render_HasCommentAction_RenderCommentActionWithHeader() var rule = Substitute.For(); rule.Action.Returns(commentAction); var adaptivityQuestion = Substitute.For(); - adaptivityQuestion.Rules.Returns(new List {rule}); + adaptivityQuestion.Rules.Returns(new List { rule }); var sut = GetRenderedComponent(adaptivityQuestion); - var commentHeader = sut.Find("h6"); - var comment = sut.Find("p.mud-typography-body1"); + var commentHeader = sut.FindAll("p")[1]; + var comment = sut.FindAll("p")[2]; Assert.Multiple(() => { Assert.That(commentHeader.InnerHtml, Is.EqualTo("AdaptivityQuestionPreview.Header.Comment")); @@ -120,12 +120,12 @@ public void Render_HasContentReferenceAction_RenderContentReferenceActionWithHea var rule = Substitute.For(); rule.Action.Returns(contentReferenceAction); var adaptivityQuestion = Substitute.For(); - adaptivityQuestion.Rules.Returns(new List {rule}); + adaptivityQuestion.Rules.Returns(new List { rule }); var sut = GetRenderedComponent(adaptivityQuestion); - var commentHeader = sut.Find("h6"); - var contentReference = sut.Find("p.mud-typography-body1"); + var commentHeader = sut.FindAll("p")[1]; + var contentReference = sut.FindAll("p")[5]; Assert.Multiple(() => { Assert.That(commentHeader.InnerHtml, Is.EqualTo("AdaptivityQuestionPreview.Header.ContentReference")); @@ -140,26 +140,38 @@ public void Render_HasElementReferenceAction_RenderElementReferenceActionWithHea var elementId = elementReferenceAction.ElementId; const string elementName = "expected"; _learningElementNamesProvider.ElementNames.Returns(doesElementExist - ? new List<(Guid, string)> {(elementId, elementName)} + ? new List<(Guid, string)> { (elementId, elementName) } : new List<(Guid, string)>()); var rule = Substitute.For(); rule.Action.Returns(elementReferenceAction); var adaptivityQuestion = Substitute.For(); - adaptivityQuestion.Rules.Returns(new List {rule}); + adaptivityQuestion.Rules.Returns(new List { rule }); var sut = GetRenderedComponent(adaptivityQuestion); - var commentHeader = sut.Find("h6"); - var elementReference = sut.Find("p.mud-typography-body1"); - Assert.Multiple(() => + if (doesElementExist) + { + var commentHeader = sut.FindAll("p")[1]; + var elementReference = sut.FindAll("p")[6]; + Assert.Multiple(() => + { + Assert.That(commentHeader.InnerHtml, Is.EqualTo("AdaptivityQuestionPreview.Header.ElementReference")); + Assert.That(elementReference.InnerHtml, Is.Not.Empty); + }); + Assert.That(elementReference.InnerHtml, Is.EqualTo(elementName)); + } + else { - Assert.That(commentHeader.InnerHtml, Is.EqualTo("AdaptivityQuestionPreview.Header.ElementReference")); - Assert.That(elementReference.InnerHtml, Is.Not.Empty); + var commentHeader = sut.FindAll("p")[1]; + var elementReference = sut.FindAll("p")[2]; + Assert.Multiple(() => + { + Assert.That(commentHeader.InnerHtml, Is.EqualTo("AdaptivityQuestionPreview.Header.ElementReference")); + Assert.That(elementReference.InnerHtml, Is.Not.Empty); + }); Assert.That(elementReference.InnerHtml, - doesElementExist - ? Is.EqualTo(elementName) - : Is.EqualTo("AdaptivityQuestionPreview.ElementReference.NotFound" + elementId)); - }); + Is.EqualTo("AdaptivityQuestionPreview.ElementReference.NotFound" + elementId)); + } } private IRenderedComponent GetRenderedComponent( diff --git a/IntegrationTest/Components/Adaptivity/Dialogues/AdaptivityContentDialogIt.cs b/IntegrationTest/Components/Adaptivity/Dialogues/AdaptivityContentDialogIt.cs index 1152a8bb7..e2583c23c 100644 --- a/IntegrationTest/Components/Adaptivity/Dialogues/AdaptivityContentDialogIt.cs +++ b/IntegrationTest/Components/Adaptivity/Dialogues/AdaptivityContentDialogIt.cs @@ -67,8 +67,8 @@ private async Task GetDialogAsync() { var dialogParameters = new DialogParameters { - {nameof(AdaptivityContentDialog.MyContent), AdaptivityContent}, - {nameof(AdaptivityContentDialog.DebounceInterval), 10} + { nameof(AdaptivityContentDialog.MyContent), AdaptivityContent }, + { nameof(AdaptivityContentDialog.DebounceInterval), 10 } }; Dialog = await OpenDialogAndGetDialogReferenceAsync(options: new DialogOptions(), parameters: dialogParameters); @@ -107,12 +107,13 @@ public async Task RenameTask_CallsPresentationLogic() var button = DialogProvider.FindComponent().Find("button"); await button.ClickAsync(new MouseEventArgs()); var textFields = DialogProvider.FindComponents>(); - var textField = textFields[0].Find("input"); + var textField = textFields[0].Find("textarea"); textField.Input("NewName"); // Wait for debounce await Task.Delay(500); DialogProvider.WaitForAssertion(() => PresentationLogic.Received(1) - .EditAdaptivityTask(Tasks.First(), "NewName", Tasks.First().MinimumRequiredDifficulty), TimeSpan.FromSeconds(2)); + .EditAdaptivityTask(Tasks.First(), "NewName", Tasks.First().MinimumRequiredDifficulty), + TimeSpan.FromSeconds(2)); PresentationLogic.ClearReceivedCalls(); textField.Input(""); @@ -128,7 +129,7 @@ public async Task ChangeRequiredDifficulty_CallsPresentationLogic([Values] bool var task = Substitute.For(); var question = Substitute.For(); question.Difficulty.Returns(QuestionDifficulty.Medium); - task.Questions.Returns(new List {question}); + task.Questions.Returns(new List { question }); task.MinimumRequiredDifficulty.Returns(wasSelectedAsRequired ? QuestionDifficulty.Medium : null); @@ -147,7 +148,7 @@ public async Task DeleteQuestionButtonClicked_CallsPresentationLogic() var task = Substitute.For(); var question = Substitute.For(); question.Difficulty.Returns(QuestionDifficulty.Medium); - task.Questions.Returns(new List {question}); + task.Questions.Returns(new List { question }); AdaptivityContent.Tasks.Add(task); await GetDialogAsync(); var iconButtons = DialogProvider.FindComponents(); diff --git a/IntegrationTest/Components/Adaptivity/Dialogues/AdaptivityQuestionDialogIt.cs b/IntegrationTest/Components/Adaptivity/Dialogues/AdaptivityQuestionDialogIt.cs index 84896c971..8f5f99a96 100644 --- a/IntegrationTest/Components/Adaptivity/Dialogues/AdaptivityQuestionDialogIt.cs +++ b/IntegrationTest/Components/Adaptivity/Dialogues/AdaptivityQuestionDialogIt.cs @@ -41,8 +41,8 @@ private async Task GetDialogAsync() { var dialogParameters = new DialogParameters { - {nameof(AdaptivityQuestionDialog.Task), Task}, - {nameof(AdaptivityQuestionDialog.Difficulty), Difficulty} + { nameof(AdaptivityQuestionDialog.Task), Task }, + { nameof(AdaptivityQuestionDialog.Difficulty), Difficulty } }; Dialog = await OpenDialogAndGetDialogReferenceAsync("title", new DialogOptions(), dialogParameters); @@ -69,7 +69,7 @@ public async Task RenderDialog_ShowsMultipleChoiceQuestionForm([Values] bool has question.Difficulty.Returns(Difficulty); if (hasQuestionToEdit) { - Task.Questions.Returns(new List {question}); + Task.Questions.Returns(new List { question }); } await GetDialogAsync(); @@ -95,7 +95,7 @@ public async Task RenderDialog_ShowsAdaptivityQuestionPreviewOfOtherQuestionsInT questionHard.Difficulty.Returns(QuestionDifficulty.Hard); if (hasOtherQuestions) { - Task.Questions.Returns(new List {questionEasy, questionHard}); + Task.Questions.Returns(new List { questionEasy, questionHard }); } await GetDialogAsync(); @@ -116,7 +116,7 @@ public async Task RenderDialog_ShowsAdaptivityQuestionPreviewOfOtherQuestionsInT Assert.Multiple(() => { Assert.That(textComponents[0].Find("h6").InnerHtml, Is.EqualTo("title")); - Assert.That(textComponents[1].Find("h6").InnerHtml, + Assert.That(textComponents[1].Find("p").InnerHtml, Is.EqualTo(hasOtherQuestions ? "AdaptivityQuestionDialog.Sidebar.Header.ExistingQuestions" : "AdaptivityQuestionDialog.Sidebar.Header.NoQuestions")); diff --git a/IntegrationTest/Components/Adaptivity/Dialogues/CreateEditCommentActionDialogIt.cs b/IntegrationTest/Components/Adaptivity/Dialogues/CreateEditCommentActionDialogIt.cs index 16b1843e7..82e8fc34d 100644 --- a/IntegrationTest/Components/Adaptivity/Dialogues/CreateEditCommentActionDialogIt.cs +++ b/IntegrationTest/Components/Adaptivity/Dialogues/CreateEditCommentActionDialogIt.cs @@ -10,7 +10,6 @@ using Presentation.PresentationLogic.LearningContent.AdaptivityContent.Action; using Presentation.PresentationLogic.LearningContent.AdaptivityContent.Question; using Presentation.PresentationLogic.LearningContent.AdaptivityContent.Trigger; -using PresentationTest; using Shared.Adaptivity; using TestHelpers; @@ -19,24 +18,6 @@ namespace IntegrationTest.Components.Adaptivity.Dialogues; [TestFixture] public class CreateEditCommentActionDialogIt : MudDialogTestFixture { - private IDialogReference Dialog { get; set; } - private CommentActionViewModel? ExistingAction { get; set; } - private IAdaptivityQuestionViewModel Question { get; set; } - private IPresentationLogic PresentationLogic { get; set; } - - private async Task GetDialogAsync() - { - var dialogParameters = new DialogParameters - { - { nameof(CreateEditCommentActionDialog.Question), Question }, - - }; - if(ExistingAction != null) - dialogParameters.Add(nameof(CreateEditCommentActionDialog.ExistingAction), ExistingAction); - Dialog = await OpenDialogAndGetDialogReferenceAsync("title", new DialogOptions(), - dialogParameters); - } - [SetUp] public async Task Setup() { @@ -53,11 +34,28 @@ public void Teardown() DialogProvider.Dispose(); } + private IDialogReference Dialog { get; set; } + private CommentActionViewModel? ExistingAction { get; set; } + private IAdaptivityQuestionViewModel Question { get; set; } + private IPresentationLogic PresentationLogic { get; set; } + + private async Task GetDialogAsync() + { + var dialogParameters = new DialogParameters + { + { nameof(CreateEditCommentActionDialog.Question), Question }, + }; + if (ExistingAction != null) + dialogParameters.Add(nameof(CreateEditCommentActionDialog.ExistingAction), ExistingAction); + Dialog = await OpenDialogAndGetDialogReferenceAsync("title", new DialogOptions(), + dialogParameters); + } + [Test] public async Task NoExistingAction_TextSet_CallsCreateAdaptivityRule() { var textField = DialogProvider.FindComponent>(); - textField.Find("input").Change("foo"); + textField.Find("textarea").Change("foo"); await DialogProvider.FindComponent().Find("button").ClickAsync(new MouseEventArgs()); @@ -73,13 +71,13 @@ public async Task ExistingAction_TextSet_CallsEditCommentAction() await GetDialogAsync(); var textField = DialogProvider.FindComponent>(); - textField.Find("input").Change("foo"); + textField.Find("textarea").Change("foo"); await DialogProvider.FindComponent().Find("button").ClickAsync(new MouseEventArgs()); PresentationLogic.Received(1).EditCommentAction(ExistingAction, "foo"); } - + [Test] public async Task ExistingAction_SameTextSet_DoesNotCallEditCommentAction() { @@ -88,7 +86,7 @@ public async Task ExistingAction_SameTextSet_DoesNotCallEditCommentAction() await GetDialogAsync(); var textField = DialogProvider.FindComponent>(); - textField.Find("input").Change(ExistingAction.Comment); + textField.Find("textarea").Change(ExistingAction.Comment); await DialogProvider.FindComponent().Find("button").ClickAsync(new MouseEventArgs()); diff --git a/IntegrationTest/Components/Adaptivity/Dialogues/CreateEditReferenceActionDialogIt.cs b/IntegrationTest/Components/Adaptivity/Dialogues/CreateEditReferenceActionDialogIt.cs index dfb01af17..71e0eea6a 100644 --- a/IntegrationTest/Components/Adaptivity/Dialogues/CreateEditReferenceActionDialogIt.cs +++ b/IntegrationTest/Components/Adaptivity/Dialogues/CreateEditReferenceActionDialogIt.cs @@ -24,26 +24,6 @@ namespace IntegrationTest.Components.Adaptivity.Dialogues; [TestFixture] public class CreateEditReferenceActionDialogIt : MudDialogTestFixture { - private IDialogReference Dialog { get; set; } - private IAdaptivityActionViewModel? ExistingAction { get; set; } - private IAdaptivityQuestionViewModel Question { get; set; } - private IPresentationLogic PresentationLogic { get; set; } - private ILearningWorldPresenter LearningWorldPresenter { get; set; } - private ILearningWorldViewModel World { get; set; } - private ILearningContentViewModel[] Contents { get; set; } - - private async Task GetDialogAsync() - { - var dialogParameters = new DialogParameters - { - { nameof(CreateEditReferenceActionDialog.Question), Question }, - }; - if (ExistingAction != null) - dialogParameters.Add(nameof(CreateEditReferenceActionDialog.ExistingAction), ExistingAction); - Dialog = await OpenDialogAndGetDialogReferenceAsync("title", new DialogOptions(), - dialogParameters); - } - [SetUp] public async Task Setup() { @@ -69,6 +49,26 @@ public void Teardown() DialogProvider.Dispose(); } + private IDialogReference Dialog { get; set; } + private IAdaptivityActionViewModel? ExistingAction { get; set; } + private IAdaptivityQuestionViewModel Question { get; set; } + private IPresentationLogic PresentationLogic { get; set; } + private ILearningWorldPresenter LearningWorldPresenter { get; set; } + private ILearningWorldViewModel World { get; set; } + private ILearningContentViewModel[] Contents { get; set; } + + private async Task GetDialogAsync() + { + var dialogParameters = new DialogParameters + { + { nameof(CreateEditReferenceActionDialog.Question), Question }, + }; + if (ExistingAction != null) + dialogParameters.Add(nameof(CreateEditReferenceActionDialog.ExistingAction), ExistingAction); + Dialog = await OpenDialogAndGetDialogReferenceAsync("title", new DialogOptions(), + dialogParameters); + } + [Test] [Ignore("Broken as long as ContentReference is blocked", Until = "2024-01-01")] public async Task NoExistingAction_ContentSelected_CallsCreateAdaptivityRuleWithContentReferenceAction() @@ -108,14 +108,14 @@ public async Task ExistingAction_ContentSelected_CallsUpdateContentReferenceActi cravm.Content = Contents.First(); ExistingAction = cravm; await GetDialogAsync(); - + await DialogProvider.Find("input").ChangeAsync(new ChangeEventArgs { Value = "foo" }); - + await DialogProvider.FindComponent().Find("button").ClickAsync(new MouseEventArgs()); PresentationLogic.Received().EditContentReferenceAction(cravm, cravm.Content, "foo"); } - + [Test] public async Task ExistingAction_ElementSelected_CallsUpdateElementReferenceAction() { @@ -123,9 +123,10 @@ public async Task ExistingAction_ElementSelected_CallsUpdateElementReferenceActi eravm.ElementId = World.AllLearningElements.First().Id; ExistingAction = eravm; await GetDialogAsync(); - - await DialogProvider.Find("input").ChangeAsync(new ChangeEventArgs { Value = "foo" }); - + + await DialogProvider.FindComponent>().Find("textarea") + .ChangeAsync(new ChangeEventArgs { Value = "foo" }); + await DialogProvider.FindComponent().Find("button").ClickAsync(new MouseEventArgs()); PresentationLogic.Received().EditElementReferenceAction(eravm, eravm.ElementId, "foo"); @@ -138,12 +139,12 @@ public async Task ExistingAction_ElementSelected_NoChange_CallsNothing() cravm.Content = Contents.First(); ExistingAction = cravm; await GetDialogAsync(); - + await DialogProvider.FindComponent().Find("button").ClickAsync(new MouseEventArgs()); PresentationLogic.DidNotReceiveWithAnyArgs().EditContentReferenceAction(cravm, cravm.Content, "foo"); } - + [Test] public async Task ExistingAction_ContentSelected_NoChange_CallsNothing() { @@ -151,7 +152,7 @@ public async Task ExistingAction_ContentSelected_NoChange_CallsNothing() eravm.ElementId = World.AllLearningElements.First().Id; ExistingAction = eravm; await GetDialogAsync(); - + await DialogProvider.FindComponent().Find("button").ClickAsync(new MouseEventArgs()); PresentationLogic.DidNotReceiveWithAnyArgs().EditElementReferenceAction(eravm, eravm.ElementId, "foo"); diff --git a/IntegrationTest/Components/Adaptivity/Forms/AdaptivityQuestion/MultipleChoiceQuestionFormIt.cs b/IntegrationTest/Components/Adaptivity/Forms/AdaptivityQuestion/MultipleChoiceQuestionFormIt.cs index e37b88dd6..f11af9619 100644 --- a/IntegrationTest/Components/Adaptivity/Forms/AdaptivityQuestion/MultipleChoiceQuestionFormIt.cs +++ b/IntegrationTest/Components/Adaptivity/Forms/AdaptivityQuestion/MultipleChoiceQuestionFormIt.cs @@ -16,6 +16,7 @@ using Presentation.PresentationLogic.API; using Presentation.PresentationLogic.LearningContent.AdaptivityContent; using Presentation.PresentationLogic.LearningContent.AdaptivityContent.Question; +using PresentationTest; using Shared.Adaptivity; using TestHelpers; @@ -146,7 +147,7 @@ public async Task OnValidate_UnknownEntity_ThrowsException() var mudForm = systemUnderTest.FindComponent(); Mapper.Map(FormModel) - .Returns((IMultipleChoiceQuestion?) null); + .Returns((IMultipleChoiceQuestion?)null); await mudForm.InvokeAsync(async () => await mudForm.Instance.Validate()); await MultipleResponseQuestionValidator.DidNotReceive() @@ -199,9 +200,7 @@ public void AddAndRemoveChoiceButtonsClicked_AddsAndRemovesChoice() { var systemUnderTest = GetRenderedComponent(); var buttons = systemUnderTest.FindComponents(); - var iconButtons = systemUnderTest.FindComponents(); var addButton = buttons[0].Find("button"); - var removeButton = iconButtons[1].Find("button"); var choices = FormModel.Choices.ToList(); Assert.That(choices, Has.Count.EqualTo(2)); Assert.That(choices[0].Text, Is.EqualTo(DefaultChoiceText + 1)); @@ -213,6 +212,8 @@ public void AddAndRemoveChoiceButtonsClicked_AddsAndRemovesChoice() Assert.That(choices[1].Text, Is.EqualTo(DefaultChoiceText + 2)); Assert.That(choices[2].Text, Is.EqualTo(DefaultChoiceText + 3)); var choiceToRemove = choices[1]; // Choice 2 + var iconButtons = systemUnderTest.FindComponentsWithMarkup("button-delete-choice"); + var removeButton = iconButtons.ElementAt(1).Find("button"); Assert.That(choices.Any(x => x.Id == choiceToRemove.Id), Is.True); removeButton.Click(); choices = FormModel.Choices.ToList(); @@ -228,9 +229,9 @@ public void ChangeCorrectness_MultipleResponse_ChangesCorrectnessOfResponse() var systemUnderTest = GetRenderedComponent(); var mudCheckBoxes = systemUnderTest.FindComponents>(); - Assert.That(mudCheckBoxes, Has.Count.EqualTo(3)); - var checkBoxChoice1 = mudCheckBoxes[1]; - var checkBoxChoice2 = mudCheckBoxes[2]; + Assert.That(mudCheckBoxes, Has.Count.EqualTo(2)); + var checkBoxChoice1 = mudCheckBoxes[0]; + var checkBoxChoice2 = mudCheckBoxes[1]; var choice1 = FormModel.Choices.First(); var choice2 = FormModel.Choices.Last(); @@ -240,15 +241,15 @@ public void ChangeCorrectness_MultipleResponse_ChangesCorrectnessOfResponse() checkBoxChoice1.Find("input").Change(true); - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice1}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice1 }); checkBoxChoice2.Find("input").Change(true); - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice1, choice2}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice1, choice2 }); checkBoxChoice1.Find("input").Change(false); - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice2}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice2 }); checkBoxChoice2.Find("input").Change(false); @@ -259,8 +260,9 @@ public void ChangeCorrectness_MultipleResponse_ChangesCorrectnessOfResponse() public void ChangeCorrectChoice_SingleResponse_ChangesTheCorrectChoice() { var systemUnderTest = GetRenderedComponent(); - var mudCheckBox = systemUnderTest.FindComponent>(); - mudCheckBox.Find("input").Change(true); + var mudCheckBox = systemUnderTest.FindComponent>(); + var checkbox = mudCheckBox.Find("input"); + checkbox.Change(true); var mudRadioButtons = systemUnderTest.FindComponents>(); Assert.That(mudRadioButtons, Has.Count.EqualTo(2)); @@ -271,26 +273,26 @@ public void ChangeCorrectChoice_SingleResponse_ChangesTheCorrectChoice() var choice2 = FormModel.Choices.Last(); var choices = FormModel.Choices.ToList(); - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice1}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice1 }); radioButtonChoice1.Find("input").Click(); - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice1}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice1 }); radioButtonChoice2.Find("input").Click(); - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice2}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice2 }); radioButtonChoice1.Find("input").Click(); - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice1}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice1 }); } [Test] public void ChangeIsSingleResponse_KeepsTheCorrectCorrectChoices() { var systemUnderTest = GetRenderedComponent(); - var mudCheckBox = systemUnderTest.FindComponent>().Find("input"); + var mudCheckBox = systemUnderTest.FindComponent>().Find("input"); var choice1 = FormModel.Choices.First(); var choice2 = FormModel.Choices.Last(); var choices = FormModel.Choices.ToList(); @@ -301,29 +303,29 @@ public void ChangeIsSingleResponse_KeepsTheCorrectCorrectChoices() mudCheckBox.Change(true); // Single response - automatically sets the first choice as correct - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice1}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice1 }); var mudRadioButtonOfChoice2 = systemUnderTest.FindComponents>().Last().Find("input"); mudRadioButtonOfChoice2.Click(); // Single response - choice 2 is now correct - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice2}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice2 }); mudCheckBox.Change(false); // Multiple response - choice 2 is still correct - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice2}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice2 }); - var mudCheckBoxOfChoice1 = systemUnderTest.FindComponents>()[1].Find("input"); + var mudCheckBoxOfChoice1 = systemUnderTest.FindComponents>()[0].Find("input"); mudCheckBoxOfChoice1.Change(true); // Multiple response - choice 1 is now also correct - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice1, choice2}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice1, choice2 }); mudCheckBox.Change(true); // Single response - choice 1 is now correct because it is the first choice in the choices list that is correct - CheckFormModelContainingChoicesAndCorrectChoices(choices, new List {choice1}); + CheckFormModelContainingChoicesAndCorrectChoices(choices, new List { choice1 }); } [Test] @@ -341,7 +343,7 @@ public async Task CreatQuestionOnValidSubmit_CallsPresentationLogic([Values] boo Assert.That(mudForm.Instance.IsValid, Is.True); // Set IsSingleResponse to testcase value - var mudCheckBoxIsSingleResponse = systemUnderTest.FindComponent>(); + var mudCheckBoxIsSingleResponse = systemUnderTest.FindComponent>(); mudCheckBoxIsSingleResponse.Find("input").Change(isSingleResponse); // Add choice @@ -363,16 +365,16 @@ public async Task CreatQuestionOnValidSubmit_CallsPresentationLogic([Values] boo if (isSingleResponse) { Assert.That(radioButtons, Has.Count.EqualTo(3)); - Assert.That(checkBoxes, Has.Count.EqualTo(1)); + Assert.That(checkBoxes, Has.Count.EqualTo(0)); checkChoice1 = radioButtons[0].Find("input"); checkChoice3 = radioButtons[2].Find("input"); } else { Assert.That(radioButtons, Has.Count.EqualTo(0)); - Assert.That(checkBoxes, Has.Count.EqualTo(4)); - checkChoice1 = checkBoxes[1].Find("input"); - checkChoice3 = checkBoxes[3].Find("input"); + Assert.That(checkBoxes, Has.Count.EqualTo(3)); + checkChoice1 = checkBoxes[0].Find("input"); + checkChoice3 = checkBoxes[2].Find("input"); } Assert.Multiple(() => @@ -455,9 +457,9 @@ public async Task CreatQuestionOnValidSubmit_CallsPresentationLogic([Values] boo FormDataContainer.FormModel.Text = "old"; FormDataContainer.FormModel.IsSingleResponse = questionToEdit is MultipleChoiceSingleResponseQuestionViewModel; - FormDataContainer.FormModel.Choices = new List {new("old1"), new("old2")}; + FormDataContainer.FormModel.Choices = new List { new("old1"), new("old2") }; FormDataContainer.FormModel.CorrectChoices = new List - {FormDataContainer.FormModel.Choices.First()}; + { FormDataContainer.FormModel.Choices.First() }; }); var systemUnderTest = GetRenderedComponent(taskVm: task, difficulty: difficulty, onSubmitted: onSubmitted, @@ -469,7 +471,7 @@ public async Task CreatQuestionOnValidSubmit_CallsPresentationLogic([Values] boo Assert.That(mudForm.Instance.IsValid, Is.True); // Set IsSingleResponse to testcase value - var mudCheckBoxIsSingleResponse = systemUnderTest.FindComponent>(); + var mudCheckBoxIsSingleResponse = systemUnderTest.FindComponent>(); mudCheckBoxIsSingleResponse.Find("input").Change(isSingleResponse); // Add choice @@ -492,7 +494,7 @@ public async Task CreatQuestionOnValidSubmit_CallsPresentationLogic([Values] boo if (isSingleResponse) { Assert.That(radioButtons, Has.Count.EqualTo(3)); - Assert.That(checkBoxes, Has.Count.EqualTo(1)); + Assert.That(checkBoxes, Has.Count.EqualTo(0)); checkChoice1 = radioButtons[0].Find("input"); checkChoice2 = radioButtons[1].Find("input"); checkChoice3 = radioButtons[2].Find("input"); @@ -500,10 +502,10 @@ public async Task CreatQuestionOnValidSubmit_CallsPresentationLogic([Values] boo else { Assert.That(radioButtons, Has.Count.EqualTo(0)); - Assert.That(checkBoxes, Has.Count.EqualTo(4)); - checkChoice1 = checkBoxes[1].Find("input"); - checkChoice2 = checkBoxes[2].Find("input"); - checkChoice3 = checkBoxes[3].Find("input"); + Assert.That(checkBoxes, Has.Count.EqualTo(3)); + checkChoice1 = checkBoxes[0].Find("input"); + checkChoice2 = checkBoxes[1].Find("input"); + checkChoice3 = checkBoxes[2].Find("input"); } Assert.Multiple(() => @@ -634,7 +636,7 @@ private void SetValidatorAllMembers() List choices => choices.Any(), _ => throw new ArgumentOutOfRangeException() }; - return valid ? Enumerable.Empty() : new[] {$"Must be {ExpectedString}"}; + return valid ? Enumerable.Empty() : new[] { $"Must be {ExpectedString}" }; } ); } diff --git a/IntegrationTest/Forms/GridSelectIt.cs b/IntegrationTest/Forms/GridSelectIt.cs index 2094c55d9..726bf865d 100644 --- a/IntegrationTest/Forms/GridSelectIt.cs +++ b/IntegrationTest/Forms/GridSelectIt.cs @@ -17,11 +17,6 @@ namespace IntegrationTest.Forms; [TestFixture(TypeArgs = new[] { typeof(GridSelectTestType) })] public class GridSelectIt : MudBlazorTestFixture> where T : notnull { - private IEnumerable Elements { get; set; } - private RenderFragment ElementTemplate { get; set; } - private IRenderedComponent> Component { get; set; } - private T? Value => Component.Instance.Value; - [SetUp] public void Init() { @@ -37,10 +32,15 @@ public void Teardown() Component.Dispose(); } + private IEnumerable Elements { get; set; } + private RenderFragment ElementTemplate { get; set; } + private IRenderedComponent> Component { get; set; } + private T? Value => Component.Instance.Value; + [Test] public void Render_RendersAllElements_WithTemplate() { - var elements = FindAllMudpaperDivs(); + var elements = FindAllMudcardDivs(); Assert.That(elements, Has.Count.EqualTo(Elements.Count())); for (var i = 0; i < elements.Count; i++) { @@ -52,12 +52,16 @@ public void Render_RendersAllElements_WithTemplate() [Test] public void ClickElement_SelectsElementAsValue() { - var elements = FindAllMudpaperDivs(); - Assert.That(() => Value, Is.EqualTo(default(T)).After(300, 10)); + var elements = FindAllMudcardDivs(); + Assert.Multiple(() => + { + Assert.That(elements, Has.Count.GreaterThan(0)); + Assert.That(() => Value, Is.EqualTo(default(T)).After(300, 10)); + }); for (var i = 0; i < elements.Count; i++) { //force re-evaluation after every re-render (click changes rendertree) - elements = FindAllMudpaperDivs(); + elements = FindAllMudcardDivs(); var element = elements[i]; element.Click(); Assert.That(() => Value, Is.EqualTo(Elements.ElementAt(i)).After(300, 10)); @@ -67,17 +71,21 @@ public void ClickElement_SelectsElementAsValue() [Test] public async Task ClickElementAgain_UnselectsElement() { - var elements = FindAllMudpaperDivs(); - Assert.That(() => Value, Is.EqualTo(default(T)).After(300, 10), "Initial value is not default(T)."); + var elements = FindAllMudcardDivs(); + Assert.Multiple(() => + { + Assert.That(elements, Has.Count.GreaterThan(0)); + Assert.That(() => Value, Is.EqualTo(default(T)).After(300, 10), "Initial value is not default(T)."); + }); for (var i = 0; i < elements.Count; i++) { //force re-evaluation after every re-render (click changes rendertree) - elements = FindAllMudpaperDivs(); + elements = FindAllMudcardDivs(); var element = elements.Single(ele => ele.ClassList.Contains($"element-{i}")); await element.ClickAsync(new MouseEventArgs()); Assert.That(() => Value, Is.EqualTo(Elements.ElementAt(i)).After(300, 10)); //force re-evaluation after every re-render (click changes rendertree) - elements = FindAllMudpaperDivs(); + elements = FindAllMudcardDivs(); element = elements.Single(ele => ele.ClassList.Contains($"element-{i}")); await element.ClickAsync(new MouseEventArgs()); Assert.That(() => Value, Is.EqualTo(default(T)).After(300, 10), $"Unselecting element {i} failed."); @@ -95,9 +103,9 @@ public void ErrorSet_DisplaysError() errorText.MarkupMatches("

some error

"); } - private IRefreshableElementCollection FindAllMudpaperDivs() + private IRefreshableElementCollection FindAllMudcardDivs() { - return Component.FindAll("div.mud-paper"); + return Component.FindAll("div.mud-card"); } private IRenderedComponent> GetRenderedComponent() @@ -118,14 +126,14 @@ internal static class GridSelectItHelper builder.AddContent(1, str); builder.CloseElement(); }; - + private static RenderFragment IntRenderer => i => builder => { builder.OpenElement(0, "p"); builder.AddContent(1, i); builder.CloseElement(); }; - + private static RenderFragment GridSelectTestTypeRenderer => t => builder => { builder.OpenElement(0, "p"); @@ -137,7 +145,7 @@ internal static class GridSelectItHelper internal static IEnumerable GetElementsForType() { if (typeof(T) == typeof(string)) return (new[] { "Foo1", "Foo2", "bar" } as IEnumerable)!; - if (typeof(T) == typeof(int)) return (new[] { 1, int.MaxValue, int.MinValue, } as IEnumerable)!; + if (typeof(T) == typeof(int)) return (new[] { 1, int.MaxValue, int.MinValue, } as IEnumerable)!; if (typeof(T) == typeof(GridSelectTestType)) return (new[] { new GridSelectTestType("Foo", 1), new GridSelectTestType("Bar", 123) } as IEnumerable)!; throw new ArgumentOutOfRangeException(); diff --git a/Presentation/Components/Adaptivity/AdaptivityQuestionPreview.razor b/Presentation/Components/Adaptivity/AdaptivityQuestionPreview.razor index deebabf60..ca90a8928 100644 --- a/Presentation/Components/Adaptivity/AdaptivityQuestionPreview.razor +++ b/Presentation/Components/Adaptivity/AdaptivityQuestionPreview.razor @@ -23,7 +23,7 @@ - @choice.Text + @choice.Text } @@ -38,7 +38,7 @@ @Localizer["AdaptivityQuestionPreview.Header.Comment"] @commentAction.Comment break; - + case ContentReferenceActionViewModel contentReferenceAction: @Localizer["AdaptivityQuestionPreview.Header.ContentReference"] @@ -56,28 +56,26 @@ @contentReferenceAction.Content break; - + case ElementReferenceActionViewModel elementReferenceAction: @Localizer["AdaptivityQuestionPreview.Header.ElementReference"] @if (LearningElementNamesProvider.ElementNames != null && LearningElementNamesProvider.ElementNames.FirstOrDefault(x => x.Item1 == elementReferenceAction.ElementId) != default) { - -
- - @if (elementReferenceAction.Comment != "") - { - @Localizer["AdaptivityQuestionPreview.Comment.Text"] - } - - @elementReferenceAction.Comment -
-
- @Localizer["AdaptivityQuestionPreview.Reference.Text"] - @LearningElementNamesProvider.ElementNames.First(x => x.Item1 == elementReferenceAction.ElementId).Item2 -
- +
+ + @if (elementReferenceAction.Comment != "") + { + @Localizer["AdaptivityQuestionPreview.Comment.Text"] + } + + @elementReferenceAction.Comment +
+
+ @Localizer["AdaptivityQuestionPreview.Reference.Text"] + @LearningElementNamesProvider.ElementNames.First(x => x.Item1 == elementReferenceAction.ElementId).Item2 +
} else { @@ -91,16 +89,12 @@ @code { - [Inject] - internal IStringLocalizer Localizer { get; set; } = null!; + [Inject] internal IStringLocalizer Localizer { get; set; } = null!; - [Inject] - internal ILearningElementNamesProvider LearningElementNamesProvider { get; set; } = null!; + [Inject] internal ILearningElementNamesProvider LearningElementNamesProvider { get; set; } = null!; - [Parameter, EditorRequired] - public IAdaptivityQuestionViewModel AdaptivityQuestion { get; set; } = null!; + [Parameter, EditorRequired] public IAdaptivityQuestionViewModel AdaptivityQuestion { get; set; } = null!; - [Parameter] - public bool HideChoices { get; set; } = false; + [Parameter] public bool HideChoices { get; set; } = false; } \ No newline at end of file diff --git a/Presentation/Components/Adaptivity/Forms/AdaptivityQuestion/MultipleChoiceQuestionForm.razor b/Presentation/Components/Adaptivity/Forms/AdaptivityQuestion/MultipleChoiceQuestionForm.razor index 807ac4427..bc2664d04 100644 --- a/Presentation/Components/Adaptivity/Forms/AdaptivityQuestion/MultipleChoiceQuestionForm.razor +++ b/Presentation/Components/Adaptivity/Forms/AdaptivityQuestion/MultipleChoiceQuestionForm.razor @@ -8,64 +8,63 @@ @using BusinessLogic.Entities.LearningContent.Adaptivity.Question @using AutoMapper @using System.Diagnostics.CodeAnalysis -
@(Task.Questions.FirstOrDefault(x => x.Difficulty == Difficulty) == null ? Localizer["MultipleChoiceQuestionForm.TitleContent.Create." + Difficulty] : Localizer["MultipleChoiceQuestionForm.TitleContent.Edit." + Difficulty]) - +
@Localizer["MultipleChoiceQuestionForm.Create.Text"] - - - -
-
- @Localizer["MultipleChoiceQuestionForm.Field.QuestionText.Text"] -
- -
- - - - @if (FormDataContainer.FormModel.IsSingleResponse == true) - { - @Localizer["MultipleChoiceQuestionForm.Switch.SingleChoice"] - } - else - { - @Localizer["MultipleChoiceQuestionForm.Switch.MultipleChoice"] - } - + + + +
+
+ @Localizer["MultipleChoiceQuestionForm.Field.QuestionText.Text"] +
+
- @Localizer["MultipleChoiceQuestionForm.Text.Choices"] - - + + + @if (FormDataContainer.FormModel.IsSingleResponse == true) + { + @Localizer["MultipleChoiceQuestionForm.Switch.SingleChoice"] + } + else + { + @Localizer["MultipleChoiceQuestionForm.Switch.MultipleChoice"] + } + +
+ + @Localizer["MultipleChoiceQuestionForm.Text.Choices"] + +
@if (FormModel.IsSingleResponse) { - - -
+ +
@foreach (var choice in FormDataContainer.FormModel.Choices) {
@@ -83,39 +82,39 @@ Icon="@Icons.Material.Filled.Delete" Disabled="FormModel.Choices.Count <= 2" Size="Size.Small" - Class="w-10 h-10"/> + Class="w-10 h-10 button-delete-choice"/>
- }
-
- + } +
+
} else {
- @foreach (var choice in FormDataContainer.FormModel.Choices) - { -
- - - - - - - -
- } + @foreach (var choice in FormDataContainer.FormModel.Choices) + { +
+ + + + + + + +
+ }
}
@@ -130,15 +129,15 @@
- - - - - @(QuestionToEdit == null ? Localizer["MultipleChoiceQuestionForm.Button.Create"] : Localizer["MultipleChoiceQuestionForm.Button.Edit"]) - - - - + + + + + @(QuestionToEdit == null ? Localizer["MultipleChoiceQuestionForm.Button.Create"] : Localizer["MultipleChoiceQuestionForm.Button.Edit"]) + + + + @code { @@ -158,26 +157,19 @@ [Inject, AllowNull] //can never be null, DI will throw exception on unresolved types internal IPresentationLogic PresentationLogic { get; set; } - [Inject, AllowNull] - internal IValidationWrapper MultipleResponseQuestionValidator { get; set; } + [Inject, AllowNull] internal IValidationWrapper MultipleResponseQuestionValidator { get; set; } - [Inject, AllowNull] - internal IValidationWrapper SingleResponseQuestionValidator { get; set; } + [Inject, AllowNull] internal IValidationWrapper SingleResponseQuestionValidator { get; set; } - [Parameter, EditorRequired] - public IAdaptivityTaskViewModel Task { get; set; } = null!; + [Parameter, EditorRequired] public IAdaptivityTaskViewModel Task { get; set; } = null!; - [Parameter, EditorRequired] - public QuestionDifficulty Difficulty { get; set; } + [Parameter, EditorRequired] public QuestionDifficulty Difficulty { get; set; } - [Parameter, EditorRequired] - public IMultipleChoiceQuestionViewModel? QuestionToEdit { get; set; } + [Parameter, EditorRequired] public IMultipleChoiceQuestionViewModel? QuestionToEdit { get; set; } - [Parameter] - public EventCallback OnSubmitted { get; set; } + [Parameter] public EventCallback OnSubmitted { get; set; } - [Parameter] - public int DebounceInterval { get; set; } = 300; + [Parameter] public int DebounceInterval { get; set; } = 300; private MultipleChoiceQuestionFormModel FormModel => FormDataContainer.FormModel; @@ -213,6 +205,7 @@ { EditQuestionOnValidSubmit(model); } + OnSubmitted.InvokeAsync(); } @@ -238,6 +231,7 @@ PresentationLogic.EditMultipleChoiceQuestionWithTypeChange(Task, QuestionToEdit, model.IsSingleResponse, model.Text, model.Choices, model.CorrectChoices, model.ExpectedCompletionTime); } + switch (QuestionToEdit) { case MultipleChoiceSingleResponseQuestionViewModel singleResponseQuestion: @@ -287,12 +281,12 @@ MultipleChoiceSingleResponseQuestion singleResponseQuestion => await SingleResponseQuestionValidator.ValidateAsync(singleResponseQuestion, propertyName), MultipleChoiceMultipleResponseQuestion multipleResponseQuestion => await MultipleResponseQuestionValidator.ValidateAsync(multipleResponseQuestion, propertyName), _ => throw new ArgumentOutOfRangeException(nameof(modelEntity), "Model entity is not a valid type") - }; + }; }); private Func>> ValidateChoiceModel => (async (obj, propertyName) => { - var modelEntity = Mapper.Map((ChoiceViewModel) obj); + var modelEntity = Mapper.Map((ChoiceViewModel)obj); return await ChoiceValidator.ValidateAsync(modelEntity, propertyName); }); diff --git a/Presentation/Components/Forms/GridSelect.razor b/Presentation/Components/Forms/GridSelect.razor index 27e8ce621..c17ddaa9b 100644 --- a/Presentation/Components/Forms/GridSelect.razor +++ b/Presentation/Components/Forms/GridSelect.razor @@ -1,6 +1,5 @@ @typeparam T where T : notnull @using System.Diagnostics.CodeAnalysis -@using Microsoft.Extensions.Localization @using MudBlazor.Utilities @inherits MudBaseInput
@@ -14,40 +13,35 @@
- -
-
- @for (var i = 0; i < FilteredElements.Count(); i++) - { - var element = FilteredElements.ElementAt(i); - - @ElementTemplate(element) - - } -
-
} + +
+
+ @for (var i = 0; i < FilteredElements.Count(); i++) + { + var element = FilteredElements.ElementAt(i); + + @ElementTemplate(element) + + } +
+
@code { - [Parameter, EditorRequired, AllowNull] - public IEnumerable Elements { get; set; } + [Parameter, EditorRequired, AllowNull] public IEnumerable Elements { get; set; } - [Parameter, EditorRequired, AllowNull] - public RenderFragment ElementTemplate { get; set; } + [Parameter, EditorRequired, AllowNull] public RenderFragment ElementTemplate { get; set; } - [Parameter] - public Func>? FilterFuncSearchableStrings { get; set; } + [Parameter] public Func>? FilterFuncSearchableStrings { get; set; } - private IEnumerable FilteredElements => FilterFuncSearchableStrings is null || string.IsNullOrWhiteSpace(_searchString) ? - Elements : - Elements.Where(ele => FilterFuncSearchableStrings(ele).Any(str => str.ToLower().Contains(_searchString.ToLower()))); + private IEnumerable FilteredElements => FilterFuncSearchableStrings is null || string.IsNullOrWhiteSpace(_searchString) ? Elements : Elements.Where(ele => FilterFuncSearchableStrings(ele).Any(str => str.ToLower().Contains(_searchString.ToLower()))); private string? _searchString = ""; diff --git a/PresentationTest/PresentationLogic/LearningWorld/LearningWorldPresenterUt.cs b/PresentationTest/PresentationLogic/LearningWorld/LearningWorldPresenterUt.cs index f75da60f5..17344da38 100644 --- a/PresentationTest/PresentationLogic/LearningWorld/LearningWorldPresenterUt.cs +++ b/PresentationTest/PresentationLogic/LearningWorld/LearningWorldPresenterUt.cs @@ -401,15 +401,15 @@ public void CreateMultipleLearningObjects_PositionIsCorrect() systemUnderTest.CreatePathWayCondition(ConditionEnum.And); systemUnderTest.LearningWorldVm.PathWayConditions.Add( - new PathWayConditionViewModel(ConditionEnum.And, false, 0, 405)); + new PathWayConditionViewModel(ConditionEnum.And, false, 0, 415)); systemUnderTest.CreateLearningSpace("foo", "bar", "foo", 5, Theme.Campus); systemUnderTest.LearningWorldVm.LearningSpaces.Add(new LearningSpaceViewModel("aa", "bb", "cc", Theme.Campus, 0, - null, 0, 405)); + null, 0, 470)); systemUnderTest.CreatePathWayCondition(ConditionEnum.And); systemUnderTest.LearningWorldVm.PathWayConditions.Add( - new PathWayConditionViewModel(ConditionEnum.And, false, 0, 405)); + new PathWayConditionViewModel(ConditionEnum.And, false, 0, 540)); Received.InOrder(() => { @@ -433,15 +433,15 @@ public void CreateMultipleLearningObjects_PositionIsCorrect() presentationLogic.Received().CreatePathWayCondition(world, ConditionEnum.And, 0, 360); - presentationLogic.Received().CreatePathWayCondition(world, ConditionEnum.And, 0, 405); + presentationLogic.Received().CreatePathWayCondition(world, ConditionEnum.And, 0, 415); //max value for positionY is 405 presentationLogic.Received().CreateLearningSpace(world, Arg.Any(), Arg.Any(), Arg.Any(), - Arg.Any(), Arg.Any(), 0, 405, Arg.Any()); + Arg.Any(), Arg.Any(), 0, 470, Arg.Any()); //max value for positionY is 405 - presentationLogic.Received().CreatePathWayCondition(world, ConditionEnum.And, 0, 405); + presentationLogic.Received().CreatePathWayCondition(world, ConditionEnum.And, 0, 540); }); }