public void StoringNoteForWrongUserId_shouldThrow() { var remarkService = new RemarkServices(landmarkRemarkContext); var location = GeometryPoint.Create(-122.12, 47.67); remarkService.Invoking(rs => rs.CreateNote("testuser1", location, "Note A")).Should().Throw <UserNotFoundException>(); }
public void GetNotesTakenOnLocation() { CreateNotes(); var remarkService = new RemarkServices(landmarkRemarkContext); var notes = remarkService.GetNotesByLocation(GeometryPoint.Create(-122.13, 47.68)); notes.Should().HaveCount(3); notes.First().Body.Should().Be("Note C"); notes.First().Owner.Username.Should().Be("testuser2"); }
public void StoreNoteOnLocation() { CreateTestUser(); var username = landmarkRemarkContext.Users.First().Username; var location = GeometryPoint.Create(-122.12, 47.67); var remarkService = new RemarkServices(landmarkRemarkContext); var noteId = remarkService.CreateNote(username, location, "Note A"); noteId.Should().Be(1); landmarkRemarkContext.Notes.Should().HaveCount(1); }
public void GetUserNotes() { CreateNotes(); var userId = landmarkRemarkContext.Users.LastOrDefault().Id; var remarkService = new RemarkServices(landmarkRemarkContext); var notes = remarkService.GetNotesByUser(userId); notes.Should().HaveCount(2); var locations = notes.GroupBy(n => n.Location).Select(n => n.Key); locations.Should().HaveCount(2); locations.Should().BeEquivalentTo(new[] { GeometryPoint.Create(-122.12, 47.67), GeometryPoint.Create(-122.13, 47.68) }); notes.Select(n => n.Body).Should().BeEquivalentTo(new[] { "Note B", "Note C" }); }
public void SearchNotesByText() { CreateNotes(); var remarkService = new RemarkServices(landmarkRemarkContext); var notesContain_ote = remarkService.GetNotesByText("ote"); notesContain_ote.Should().HaveCount(3); var usernames = notesContain_ote.Select(n => n.Owner.Username).Distinct(); usernames.Should().BeEquivalentTo(new[] { "testuser1", "testuser2" }); var notesContain_B = remarkService.GetNotesByText("B"); notesContain_B.Should().HaveCount(1); usernames = notesContain_B.Select(n => n.Owner.Username); usernames.Should().BeEquivalentTo(new[] { "testuser2" }); }