public GetNotesResponse GetNotes() { GetNotesResponse response = new GetNotesResponse(); try { IEnumerable <NoteView> notes = _noteRepository.FindAll() .ConvertToNoteViews(); response.NoteViews = notes; } catch (Exception ex) { } return(response); }
public void GetNotesUseCaseEqualTest() { GetNotesRequest getNotesRequest = new GetNotesRequest(idAccount); IUnitOfWorkFactory unitOfWorkFactory = new UnitOfWorkFactory(); IUnitOfWork unitOfWork = unitOfWorkFactory.CreateUnitOfWork(); unitOfWork.GetNotesFromDatabase(); IActivityFactory activityFactory = new ActivityFactory(unitOfWork, new ValidationRuleFactory()); IUseCaseFactory useCaseFactory = new UseCaseFactory(activityFactory); GetNotesResponse getNotesResponse = useCaseFactory.CreateGetNotesUseCase().Execute(getNotesRequest); Assert.AreEqual(getNotesResponse.Notes[0].Topic, this.topic); Assert.AreEqual(getNotesResponse.Notes[0].Text, this.text); Assert.AreEqual(getNotesResponse.Notes[0].Date, this.date); Assert.AreEqual(getNotesResponse.Notes[0].Image, this.image); }
public async Task <OperationStatusInfo> ShowNotes(int idAccount) { return(await Task.Run(() => { OperationStatusInfo operationStatusInfo = new OperationStatusInfo(operationStatus: OperationStatus.Done); GetNotesRequest getNotesRequest = new GetNotesRequest(idAccount); try { GetNotesResponse getNotesResponse = hubController.UseCaseFactory.CreateGetNotesUseCase().Execute(getNotesRequest); List <NotesDTO> notesDTO = hubController.TransformNotes(getNotesResponse.Notes); operationStatusInfo.AttachedObject = notesDTO; } catch (Exception ex) { Console.WriteLine(ex.Message); operationStatusInfo.OperationStatus = OperationStatus.Cancelled; operationStatusInfo.AttachedInfo = ex.Message; } return operationStatusInfo; })); }