public async Task TestGetNoteById() { // arrange var note = await _persistence.CreateNoteAsync(null, NoteTestModelV1.GenerateRandomNote()); // act var result = await _persistence.GetNoteByIdAsync(null, note.Id); // assert NoteTestModelV1.AssertEqual(note, result); }
public async Task TestUpdateNote() { // arrange var note = await _persistence.CreateNoteAsync(null, NoteTestModelV1.GenerateRandomNote()); // act note.Title = "T"; note.Description = "holiday"; var result = await _persistence.UpdateNoteAsync(null, note); // assert NoteTestModelV1.AssertEqual(note, result); }
public async Task IT_Should_Test_Crud_Operations() { var expectedNote1 = NoteTestModelV1.GenerateRandomNote(); var Note1 = await Invoke <NoteV1>("create_note", new { Note = expectedNote1 }); NoteTestModelV1.AssertEqual(expectedNote1, Note1); var expectedNote2 = NoteTestModelV1.GenerateRandomNote(); var Note2 = await Invoke <NoteV1>("create_note", new { Note = expectedNote2 }); NoteTestModelV1.AssertEqual(expectedNote2, Note2); var page = await Invoke <DataPage <NoteV1> >("get_notes", new { }); Assert.NotNull(page); Assert.Equal(2, page.Data.Count); Note1.Title = "Updated Type"; Note1.Description = "Updated Code"; var Note = await Invoke <NoteV1>("update_note", new { Note = Note1 }); NoteTestModelV1.AssertEqual(Note1, Note); Note = await Invoke <NoteV1>("delete_note_by_id", new { id = Note1.Id }); Assert.NotNull(Note); Assert.Equal(Note1.Id, Note.Id); Note = await Invoke <NoteV1>("delete_note_by_id", new { id = Note1.Id }); Assert.Null(Note); Note = await Invoke <NoteV1>("delete_note_by_id", new { id = Note2.Id }); Assert.NotNull(Note); Assert.Equal(Note2.Id, Note.Id); Note = await Invoke <NoteV1>("get_note_by_id", new { id = Note2.Id }); Assert.Null(Note); }
public async Task TestGetNoteByIdsFilter() { // arrange var note1 = await _persistence.CreateNoteAsync(null, NoteTestModelV1.GenerateRandomNote()); var note2 = await _persistence.CreateNoteAsync(null, NoteTestModelV1.GenerateRandomNote()); var note3 = await _persistence.CreateNoteAsync(null, NoteTestModelV1.GenerateRandomNote()); var filter = FilterParams.FromTuples( "ids", $"{note2.Id}" ); // act var result = await _persistence.GetNotesAsync(null, filter, null); // assert Assert.NotNull(result); Assert.Single(result.Data); NoteTestModelV1.AssertEqual(note2, result.Data[0]); }
public async Task TestGetNotesByComplexFilter() { // arrange var note1 = await _persistence.CreateNoteAsync(null, NoteTestModelV1.GenerateRandomNote()); var note2 = await _persistence.CreateNoteAsync(null, NoteTestModelV1.GenerateRandomNote()); var note3 = await _persistence.CreateNoteAsync(null, NoteTestModelV1.GenerateRandomNote()); var filter = FilterParams.FromTuples( "ids", $"{note2.Id},{note1.Id}", "Ids", $"{note1.Id}", "type", note1.Title, "code", note1.Description ); // act var result = await _persistence.GetNotesAsync(null, filter, null); // assert Assert.NotNull(result); Assert.Single(result.Data); NoteTestModelV1.AssertEqual(note1, result.Data[0]); }