|
|
|
@ -6,6 +6,7 @@ namespace Notus_UnitTest_User
|
|
|
|
|
public class SearchNoteByNameTests
|
|
|
|
|
{
|
|
|
|
|
private User owner;
|
|
|
|
|
private string searchName;
|
|
|
|
|
|
|
|
|
|
[SetUp]
|
|
|
|
|
public void SetUp()
|
|
|
|
@ -14,6 +15,7 @@ namespace Notus_UnitTest_User
|
|
|
|
|
owner.CreateNote("Note 1", "image1.png");
|
|
|
|
|
owner.CreateNote("Note 2", "image2.png");
|
|
|
|
|
owner.CreateNote("Another Note", "image3.png");
|
|
|
|
|
searchName = "note";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
@ -32,5 +34,23 @@ namespace Notus_UnitTest_User
|
|
|
|
|
List<Note> result = owner.SearchNoteByName(owner.GetNoteList(), "test");
|
|
|
|
|
Assert.That(result, Is.Empty);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void SearchFavoriteNoteByName_ShouldReturnMatchingNotes()
|
|
|
|
|
{
|
|
|
|
|
List<Note> searchedNotes = owner.SearchFavoriteNoteByName(owner.GetNoteList(), searchName);
|
|
|
|
|
Assert.That(searchedNotes, Has.Count.EqualTo(4));
|
|
|
|
|
CollectionAssert.Contains(searchedNotes, owner.GetNoteList()[0]);
|
|
|
|
|
CollectionAssert.Contains(searchedNotes, owner.GetNoteList()[1]);
|
|
|
|
|
CollectionAssert.Contains(searchedNotes, owner.GetNoteList()[2]);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Test]
|
|
|
|
|
public void SearchFavoriteNoteByName_ShouldReturnEmptyList_WhenNoMatchFound()
|
|
|
|
|
{
|
|
|
|
|
searchName = "nonexistent";
|
|
|
|
|
List<Note> searchedNotes = owner.SearchFavoriteNoteByName(owner.GetNoteList(), searchName);
|
|
|
|
|
Assert.That(searchedNotes, Is.Empty);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|