Exemple #1
0
        public async Task <IHttpActionResult> PostAsync(Note noteToAdd)
        {
            ModelStateNoteForCreationValidation(noteToAdd);

            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var addedNote = await _creationService.CreateAsync(noteToAdd);

            return(Created(_locationHelper.GetNotesUrlWithId(addedNote.Id), addedNote));
        }
        public void GetUrlWithId_BuildUrl_ReturnsCorrectLocation()
        {
            var actualUrl = _urlLocationHelper.GetNotesUrlWithId(new Guid(Id));

            Assert.That(actualUrl, Is.EqualTo($"/{Id}/test"));
        }