Пример #1
0
        public async Task <IActionResult> Create(
            [FromServices] ICreateNoteUseCase useCase,
            [FromServices] CreateNotePresenter presenter,
            [FromBody] CreateNoteDto _)
        {
            await useCase.Execute(new CreateNoteInput(_.Title, _.Text));

            return(presenter.ViewModel);
        }
Пример #2
0
        public async Task CreateNoteWithWrongTitleLength_NotNull(string title)
        {
            var presenter = new CreateNotePresenter();
            var useCase   = new CreateNoteUseCase(
                new Mock <IApplicationDbContext>().Object,
                new Mock <ICurrentUserService>().Object,
                presenter);

            await useCase.Execute(new CreateNoteInput(title, "text"));

            var value = presenter.ViewModel.GetPropertyValue("Value");

            Assert.True(value == "Title length must be more than 1 character");
        }