public void CanCreateNote() { // ARRANGE var newNoteMessage = Substitute.For <NewNoteMessage>(); var expectedNoteDto = Substitute.For <NoteDto>(); _noteTaker.TakeNote(Arg.Any <SecurityContext>(), newNoteMessage).Returns(expectedNoteDto); // ACT var result = _subjectUnderTest.Post(newNoteMessage); // ASSERT Assert.That(result, Is.Not.Null); _noteTaker.Received(1).TakeNote(Arg.Any <SecurityContext>(), newNoteMessage); }
public IActionResult Post([FromBody] NewNoteMessage newNoteMessage) { var noteDto = _noteTaker.TakeNote(SecurityContext, newNoteMessage); return(CreatedAtRoute("GetNote", new { id = noteDto.Id }, noteDto)); }