From bf91d1fde28cdb62a858bb9db9d21fc2eb498ac0 Mon Sep 17 00:00:00 2001 From: alina-dicoiu Date: Sat, 30 Oct 2021 11:57:25 +0300 Subject: [PATCH] added stepSubmitAnswer mutation with mock repository --- .../GraphQL/TeacherWorkoutMutation.cs | 17 +- .../Types/Inputs/StepSubmitAnswerInputType.cs | 16 ++ .../Payloads/StepSubmitAnswerPayloadType.cs | 17 ++ TeacherWorkout.Api/Startup.cs | 16 +- TeacherWorkout.Domain/Common/IValidator.cs | 12 ++ .../Lessons/IAnswerRepository.cs | 9 + .../Lessons/IStepRepository.cs | 4 +- .../Lessons/StepSubmitAnswerInputValidator.cs | 39 ++++ TeacherWorkout.Domain/Lessons/SubmitAnswer.cs | 49 +++++ .../Models/Inputs/StepSubmitAnswerInput.cs | 12 ++ .../Payloads/StepSubmitAnswerPayload.cs | 9 + .../Repositories/AnswerRepository.cs | 43 ++++ .../Repositories/StepRepository.cs | 184 +++++++++--------- 13 files changed, 335 insertions(+), 92 deletions(-) create mode 100644 TeacherWorkout.Api/GraphQL/Types/Inputs/StepSubmitAnswerInputType.cs create mode 100644 TeacherWorkout.Api/GraphQL/Types/Payloads/StepSubmitAnswerPayloadType.cs create mode 100644 TeacherWorkout.Domain/Common/IValidator.cs create mode 100644 TeacherWorkout.Domain/Lessons/IAnswerRepository.cs create mode 100644 TeacherWorkout.Domain/Lessons/StepSubmitAnswerInputValidator.cs create mode 100644 TeacherWorkout.Domain/Lessons/SubmitAnswer.cs create mode 100644 TeacherWorkout.Domain/Models/Inputs/StepSubmitAnswerInput.cs create mode 100644 TeacherWorkout.Domain/Models/Payloads/StepSubmitAnswerPayload.cs create mode 100644 TeacherWorkout.MockData/Repositories/AnswerRepository.cs diff --git a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs index a353be0..a9407b7 100644 --- a/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs +++ b/TeacherWorkout.Api/GraphQL/TeacherWorkoutMutation.cs @@ -11,8 +11,10 @@ namespace TeacherWorkout.Api.GraphQL { public class TeacherWorkoutMutation : ObjectGraphType { - public TeacherWorkoutMutation(CompleteStep completeStep, - CreateTheme createTheme) + public TeacherWorkoutMutation( + CompleteStep completeStep, + CreateTheme createTheme, + SubmitAnswer submitAnswer) { Name = "Mutation"; @@ -38,6 +40,17 @@ public TeacherWorkoutMutation(CompleteStep completeStep, return completeStep.Execute(input); }); + Field( + "stepSubmitAnswer", + arguments: new QueryArguments( + new QueryArgument> { Name = "input" } + ), + resolve: context => + { + var input = context.GetArgument("input"); + return submitAnswer.Execute(input); + }); + Field( "themeCreate", arguments: new QueryArguments( diff --git a/TeacherWorkout.Api/GraphQL/Types/Inputs/StepSubmitAnswerInputType.cs b/TeacherWorkout.Api/GraphQL/Types/Inputs/StepSubmitAnswerInputType.cs new file mode 100644 index 0000000..105251f --- /dev/null +++ b/TeacherWorkout.Api/GraphQL/Types/Inputs/StepSubmitAnswerInputType.cs @@ -0,0 +1,16 @@ +using GraphQL.Types; +using TeacherWorkout.Domain.Models.Inputs; + +namespace TeacherWorkout.Api.GraphQL.Types.Inputs +{ + public class StepSubmitAnswerInputType : InputObjectGraphType + { + public StepSubmitAnswerInputType() + { + Name = "StepSubmitAnswerInput"; + + Field(x => x.StepId, type: typeof(NonNullGraphType)); + Field(x => x.AnswerIds, type: typeof(ListGraphType)); + } + } +} diff --git a/TeacherWorkout.Api/GraphQL/Types/Payloads/StepSubmitAnswerPayloadType.cs b/TeacherWorkout.Api/GraphQL/Types/Payloads/StepSubmitAnswerPayloadType.cs new file mode 100644 index 0000000..da88d4b --- /dev/null +++ b/TeacherWorkout.Api/GraphQL/Types/Payloads/StepSubmitAnswerPayloadType.cs @@ -0,0 +1,17 @@ +using GraphQL.Types; +using TeacherWorkout.Domain.Models.Payloads; + +namespace TeacherWorkout.Api.GraphQL.Types.Payloads +{ + public class StepSubmitAnswerPayloadType : ObjectGraphType + { + public StepSubmitAnswerPayloadType() + { + Name = "StepSubmitAnswerPayload"; + + Field(x => x.Step, type: typeof(StepUnionType)).Description("The completed step."); + Field(x => x.LessonStatus).Description("The status of the lesson."); + } + + } +} diff --git a/TeacherWorkout.Api/Startup.cs b/TeacherWorkout.Api/Startup.cs index 39034a7..80a4c78 100644 --- a/TeacherWorkout.Api/Startup.cs +++ b/TeacherWorkout.Api/Startup.cs @@ -28,7 +28,7 @@ public Startup(IConfiguration configuration) public void ConfigureServices(IServiceCollection services) { EnsureReferencedAssembliesAreLoaded(); - + services.AddCors(options => { options.AddDefaultPolicy(builder => @@ -43,6 +43,7 @@ public void ConfigureServices(IServiceCollection services) services.AddScoped(); services.AddScoped(); AddOperations(services); + AddValidators(services); AddRepositories(services, "TeacherWorkout.MockData"); AddRepositories(services, "TeacherWorkout.Data"); @@ -92,6 +93,17 @@ private static void AddOperations(IServiceCollection services) .ForEach(t => services.AddScoped(t)); } + private static void AddValidators(IServiceCollection services) + { + var validatorType = typeof(IValidator); + AppDomain.CurrentDomain.GetAssemblies() + .SelectMany(t => t.GetTypes()) + .Where(t => t.IsClass) + .Where(t => t.GetInterfaces().Contains(validatorType)) + .ToList() + .ForEach(t => services.AddScoped(t)); + } + private static void AddRepositories(IServiceCollection services, string sourceNamespace) { AppDomain.CurrentDomain.GetAssemblies() @@ -106,7 +118,7 @@ private static void AddRepositories(IServiceCollection services, string sourceNa services.AddScoped(repositoryInterface, t); }); } - + private static void EnsureReferencedAssembliesAreLoaded() { // We need to reference something in the assembly to make it load diff --git a/TeacherWorkout.Domain/Common/IValidator.cs b/TeacherWorkout.Domain/Common/IValidator.cs new file mode 100644 index 0000000..322a843 --- /dev/null +++ b/TeacherWorkout.Domain/Common/IValidator.cs @@ -0,0 +1,12 @@ +namespace TeacherWorkout.Domain.Common +{ + public interface IValidator + { + + } + + public interface IValidator : IValidator + { + public bool IsValid(T input); + } +} diff --git a/TeacherWorkout.Domain/Lessons/IAnswerRepository.cs b/TeacherWorkout.Domain/Lessons/IAnswerRepository.cs new file mode 100644 index 0000000..02f7b7f --- /dev/null +++ b/TeacherWorkout.Domain/Lessons/IAnswerRepository.cs @@ -0,0 +1,9 @@ +using TeacherWorkout.Domain.Models; + +namespace TeacherWorkout.Domain.Lessons +{ + public interface IAnswerRepository + { + public Answer Find(string id); + } +} diff --git a/TeacherWorkout.Domain/Lessons/IStepRepository.cs b/TeacherWorkout.Domain/Lessons/IStepRepository.cs index e1a6f7d..e51017d 100644 --- a/TeacherWorkout.Domain/Lessons/IStepRepository.cs +++ b/TeacherWorkout.Domain/Lessons/IStepRepository.cs @@ -1,5 +1,5 @@ +using System.Collections.Generic; using TeacherWorkout.Domain.Models; -using TeacherWorkout.Domain.Models.Payloads; namespace TeacherWorkout.Domain.Lessons { @@ -8,5 +8,7 @@ public interface IStepRepository ILessonStep Find(string id); ILessonStep CompleteStep(string id); + + ILessonStep SubmitAnswer(string id, IEnumerable answerIds); } } \ No newline at end of file diff --git a/TeacherWorkout.Domain/Lessons/StepSubmitAnswerInputValidator.cs b/TeacherWorkout.Domain/Lessons/StepSubmitAnswerInputValidator.cs new file mode 100644 index 0000000..1cd0c86 --- /dev/null +++ b/TeacherWorkout.Domain/Lessons/StepSubmitAnswerInputValidator.cs @@ -0,0 +1,39 @@ +using TeacherWorkout.Domain.Common; +using TeacherWorkout.Domain.Models.Inputs; + +namespace TeacherWorkout.Domain.Lessons +{ + public class StepSubmitAnswerInputValidator : IValidator + { + private readonly IStepRepository _stepRepository; + private readonly IAnswerRepository _answerRepository; + + public StepSubmitAnswerInputValidator(IStepRepository stepRepository, IAnswerRepository answerRepository) + { + _stepRepository = stepRepository; + _answerRepository = answerRepository; + } + + public bool IsValid(StepSubmitAnswerInput input) + { + var step = _stepRepository.Find(input.StepId); + + if (step == null) + { + return false; + } + + foreach (var answerId in input.AnswerIds) + { + var answer = _answerRepository.Find(answerId); + + if (answer == null) + { + return false; + } + } + + return true; + } + } +} diff --git a/TeacherWorkout.Domain/Lessons/SubmitAnswer.cs b/TeacherWorkout.Domain/Lessons/SubmitAnswer.cs new file mode 100644 index 0000000..ccd3ea7 --- /dev/null +++ b/TeacherWorkout.Domain/Lessons/SubmitAnswer.cs @@ -0,0 +1,49 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using TeacherWorkout.Domain.Common; +using TeacherWorkout.Domain.Models; +using TeacherWorkout.Domain.Models.Inputs; +using TeacherWorkout.Domain.Models.Payloads; + +namespace TeacherWorkout.Domain.Lessons +{ + public class SubmitAnswer : IOperation + { + private readonly IStepRepository _stepRepository; + private readonly ILessonStatusRepository _lessonStatusRepository; + private readonly StepSubmitAnswerInputValidator _validator; + + public SubmitAnswer(IStepRepository stepRepository, ILessonStatusRepository lessonStatusRepository, StepSubmitAnswerInputValidator validator) + { + _stepRepository = stepRepository; + _lessonStatusRepository = lessonStatusRepository; + _validator = validator; + } + + public StepSubmitAnswerPayload Execute(StepSubmitAnswerInput input) + { + if (!_validator.IsValid(input)) + { + throw new ArgumentException("Input is not valid"); + } + + var step = _stepRepository.SubmitAnswer(input.StepId, input.AnswerIds); + var lessonId = (step.GetType().GetProperty("Lesson").GetValue(step) as Lesson).Id; + + var lessonStatus = _lessonStatusRepository + .List( + new LessonStatusFilter() + { + LessonIds = new List() { lessonId } + }) + .FirstOrDefault(); + + return new StepSubmitAnswerPayload() + { + Step = step, + LessonStatus = lessonStatus + }; + } + } +} diff --git a/TeacherWorkout.Domain/Models/Inputs/StepSubmitAnswerInput.cs b/TeacherWorkout.Domain/Models/Inputs/StepSubmitAnswerInput.cs new file mode 100644 index 0000000..f0bdd8c --- /dev/null +++ b/TeacherWorkout.Domain/Models/Inputs/StepSubmitAnswerInput.cs @@ -0,0 +1,12 @@ +using System.Collections.Generic; + +namespace TeacherWorkout.Domain.Models.Inputs +{ + public class StepSubmitAnswerInput + { + public string StepId { get; set; } + + public IEnumerable AnswerIds { get; set; } + + } +} diff --git a/TeacherWorkout.Domain/Models/Payloads/StepSubmitAnswerPayload.cs b/TeacherWorkout.Domain/Models/Payloads/StepSubmitAnswerPayload.cs new file mode 100644 index 0000000..034679d --- /dev/null +++ b/TeacherWorkout.Domain/Models/Payloads/StepSubmitAnswerPayload.cs @@ -0,0 +1,9 @@ +namespace TeacherWorkout.Domain.Models.Payloads +{ + public class StepSubmitAnswerPayload + { + public ILessonStep Step { get; set; } + + public LessonStatus LessonStatus { get; set; } + } +} diff --git a/TeacherWorkout.MockData/Repositories/AnswerRepository.cs b/TeacherWorkout.MockData/Repositories/AnswerRepository.cs new file mode 100644 index 0000000..2c6f286 --- /dev/null +++ b/TeacherWorkout.MockData/Repositories/AnswerRepository.cs @@ -0,0 +1,43 @@ +using System; +using TeacherWorkout.Domain.Lessons; +using TeacherWorkout.Domain.Models; + +namespace TeacherWorkout.MockData.Repositories +{ + public class AnswerRepository : IAnswerRepository + { + public Answer Find(string id) + { + switch (id) + { + case "1": + { + return new Answer + { + Id = "1", + Title = "42" + }; + } + + case "2": + { + return new Answer + { + Id = "2", + Title = "13" + }; + } + case "3": + { + return new Answer + { + Id = "3", + Title = "There is NONE" + }; + } + default: + throw new ArgumentException("Does not exist"); + } + } + } +} diff --git a/TeacherWorkout.MockData/Repositories/StepRepository.cs b/TeacherWorkout.MockData/Repositories/StepRepository.cs index 45bffc8..9ef4161 100644 --- a/TeacherWorkout.MockData/Repositories/StepRepository.cs +++ b/TeacherWorkout.MockData/Repositories/StepRepository.cs @@ -8,6 +8,12 @@ namespace TeacherWorkout.MockData.Repositories public class StepRepository : IStepRepository { public ILessonStep CompleteStep(string id) + { + return GetStepWithLesson(id); + + } + + public ILessonStep Find(string id) { switch (id) { @@ -17,18 +23,14 @@ public ILessonStep CompleteStep(string id) Id = "1", Title = "My title 1", Description = - "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum;", + "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum;", Image = new Image { Description = "Cat Photo", Url = - "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Felis_catus-cat_on_snow.jpg/640px-Felis_catus-cat_on_snow.jpg" + "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Felis_catus-cat_on_snow.jpg/640px-Felis_catus-cat_on_snow.jpg" }, - PreviousStep = null, - Lesson = new Lesson() - { - Id = "1" - } + PreviousStep = null }; case "2": return new SlideStep @@ -36,29 +38,25 @@ public ILessonStep CompleteStep(string id) Id = "2", Title = "My title 2", Description = - "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).", + "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).", Image = new Image { Description = "Cat Photo", Url = - "https://imagesvc.meredithcorp.io/v3/mm/image?url=https%3A%2F%2Fstatic.onecms.io%2Fwp-content%2Fuploads%2Fsites%2F12%2F2015%2F06%2Fcrazy-cat.jpg&q=85" + "https://imagesvc.meredithcorp.io/v3/mm/image?url=https%3A%2F%2Fstatic.onecms.io%2Fwp-content%2Fuploads%2Fsites%2F12%2F2015%2F06%2Fcrazy-cat.jpg&q=85" }, PreviousStep = new SlideStep { Id = "1", Description = - "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum;", + "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum;", Image = new Image { Description = "Cat Photo", Url = - "https://www.google.com/url?sa=i&url=https%3A%2F%2Ficatcare.org%2F&psig=AOvVaw0nBkNYvmgGLHcuursLSpxE&ust=1624782643255000&source=images&cd=vfe&ved=0CAoQjRxqFwoTCJCJqI3ytPECFQAAAAAdAAAAABAJ" + "https://www.google.com/url?sa=i&url=https%3A%2F%2Ficatcare.org%2F&psig=AOvVaw0nBkNYvmgGLHcuursLSpxE&ust=1624782643255000&source=images&cd=vfe&ved=0CAoQjRxqFwoTCJCJqI3ytPECFQAAAAAdAAAAABAJ" }, PreviousStep = null - }, - Lesson = new Lesson() - { - Id = "1" } }; case "3": @@ -83,10 +81,6 @@ public ILessonStep CompleteStep(string id) Id = "3", Title = "There is NONE" }, - }, - Lesson = new Lesson() - { - Id = "1" } }; case "4": @@ -94,38 +88,34 @@ public ILessonStep CompleteStep(string id) { Id = "4", Results = new List + { + new() { - new() - { - Status = AnswerStatus.Correct, - Answer = new Answer - { - Id = "1", - Title = "42" - } - }, - new() + Status = AnswerStatus.Correct, + Answer = new Answer { - Status = AnswerStatus.None, - Answer = new Answer - { - Id = "2", - Title = "13" - } - }, - new() + Id = "1", + Title = "42" + } + }, + new() + { + Status = AnswerStatus.None, + Answer = new Answer { - Status = AnswerStatus.Incorrect, - Answer = new Answer - { - Id = "3", - Title = "There is NONE" - } + Id = "2", + Title = "13" } }, - Lesson = new Lesson() - { - Id = "1" + new() + { + Status = AnswerStatus.Incorrect, + Answer = new Answer + { + Id = "3", + Title = "There is NONE" + } + } } }; case "5": @@ -140,29 +130,25 @@ public ILessonStep CompleteStep(string id) Description = "Cat Photo", Url = "https://www.google.com/url?sa=i&url=https%3A%2F%2Ficatcare.org%2F&psig=AOvVaw0nBkNYvmgGLHcuursLSpxE&ust=1624782643255000&source=images&cd=vfe&ved=0CAoQjRxqFwoTCJCJqI3ytPECFQAAAAAdAAAAABAJ" - }, - Lesson = new Lesson() - { - Id = "1" } }; case "6": return new LessonSummaryStep { Id = "6", - ExperiencePoints = 100, - Lesson = new Lesson() - { - Id = "1" - } + ExperiencePoints = 100 }; default: throw new ArgumentException("Does not exist"); } + } + public ILessonStep SubmitAnswer(string id, IEnumerable answerIds) + { + return GetStepWithLesson(id); } - public ILessonStep Find(string id) + private static ILessonStep GetStepWithLesson(string id) { switch (id) { @@ -172,14 +158,18 @@ public ILessonStep Find(string id) Id = "1", Title = "My title 1", Description = - "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum;", + "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum;", Image = new Image { Description = "Cat Photo", Url = - "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Felis_catus-cat_on_snow.jpg/640px-Felis_catus-cat_on_snow.jpg" + "https://upload.wikimedia.org/wikipedia/commons/thumb/b/b6/Felis_catus-cat_on_snow.jpg/640px-Felis_catus-cat_on_snow.jpg" }, - PreviousStep = null + PreviousStep = null, + Lesson = new Lesson() + { + Id = "1" + } }; case "2": return new SlideStep @@ -187,25 +177,29 @@ public ILessonStep Find(string id) Id = "2", Title = "My title 2", Description = - "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).", + "It is a long established fact that a reader will be distracted by the readable content of a page when looking at its layout. The point of using Lorem Ipsum is that it has a more-or-less normal distribution of letters, as opposed to using 'Content here, content here', making it look like readable English. Many desktop publishing packages and web page editors now use Lorem Ipsum as their default model text, and a search for 'lorem ipsum' will uncover many web sites still in their infancy. Various versions have evolved over the years, sometimes by accident, sometimes on purpose (injected humour and the like).", Image = new Image { Description = "Cat Photo", Url = - "https://imagesvc.meredithcorp.io/v3/mm/image?url=https%3A%2F%2Fstatic.onecms.io%2Fwp-content%2Fuploads%2Fsites%2F12%2F2015%2F06%2Fcrazy-cat.jpg&q=85" + "https://imagesvc.meredithcorp.io/v3/mm/image?url=https%3A%2F%2Fstatic.onecms.io%2Fwp-content%2Fuploads%2Fsites%2F12%2F2015%2F06%2Fcrazy-cat.jpg&q=85" }, PreviousStep = new SlideStep { Id = "1", Description = - "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum;", + "Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum;", Image = new Image { Description = "Cat Photo", Url = - "https://www.google.com/url?sa=i&url=https%3A%2F%2Ficatcare.org%2F&psig=AOvVaw0nBkNYvmgGLHcuursLSpxE&ust=1624782643255000&source=images&cd=vfe&ved=0CAoQjRxqFwoTCJCJqI3ytPECFQAAAAAdAAAAABAJ" + "https://www.google.com/url?sa=i&url=https%3A%2F%2Ficatcare.org%2F&psig=AOvVaw0nBkNYvmgGLHcuursLSpxE&ust=1624782643255000&source=images&cd=vfe&ved=0CAoQjRxqFwoTCJCJqI3ytPECFQAAAAAdAAAAABAJ" }, PreviousStep = null + }, + Lesson = new Lesson() + { + Id = "1" } }; case "3": @@ -230,6 +224,10 @@ public ILessonStep Find(string id) Id = "3", Title = "There is NONE" }, + }, + Lesson = new Lesson() + { + Id = "1" } }; case "4": @@ -237,34 +235,38 @@ public ILessonStep Find(string id) { Id = "4", Results = new List - { - new() { - Status = AnswerStatus.Correct, - Answer = new Answer + new() { - Id = "1", - Title = "42" - } - }, - new() - { - Status = AnswerStatus.None, - Answer = new Answer + Status = AnswerStatus.Correct, + Answer = new Answer + { + Id = "1", + Title = "42" + } + }, + new() { - Id = "2", - Title = "13" - } - }, - new() - { - Status = AnswerStatus.Incorrect, - Answer = new Answer + Status = AnswerStatus.None, + Answer = new Answer + { + Id = "2", + Title = "13" + } + }, + new() { - Id = "3", - Title = "There is NONE" + Status = AnswerStatus.Incorrect, + Answer = new Answer + { + Id = "3", + Title = "There is NONE" + } } - } + }, + Lesson = new Lesson() + { + Id = "1" } }; case "5": @@ -279,13 +281,21 @@ public ILessonStep Find(string id) Description = "Cat Photo", Url = "https://www.google.com/url?sa=i&url=https%3A%2F%2Ficatcare.org%2F&psig=AOvVaw0nBkNYvmgGLHcuursLSpxE&ust=1624782643255000&source=images&cd=vfe&ved=0CAoQjRxqFwoTCJCJqI3ytPECFQAAAAAdAAAAABAJ" + }, + Lesson = new Lesson() + { + Id = "1" } }; case "6": return new LessonSummaryStep { Id = "6", - ExperiencePoints = 100 + ExperiencePoints = 100, + Lesson = new Lesson() + { + Id = "1" + } }; default: throw new ArgumentException("Does not exist");