public void Find_ByTitle_Returns_OrderedResults() { // arrange var dbName = Guid.NewGuid().ToString(); var db = GetMemoryDb(dbName); var sut = new AssetRepository(db); var pager = new Pager(1); // act var result = sut.Find(x => x.Title.Contains("Asset"), pager); ClearMemoryDb(dbName); // assert Assert.True(result.First().LastUpdated > result.Last().LastUpdated); }
public void Find_ById_Matching_1_Asset_Returns_1_Result() { // arrange var dbName = Guid.NewGuid().ToString(); var db = GetMemoryDb(dbName); var sut = new AssetRepository(db); var pager = new Pager(1, 1); // act var result = sut.Find(x => x.Id == 8, pager); ClearMemoryDb(dbName); // assert Assert.Equal(8, result.First().Id); }
public void Find_ByTitle_Matching_10_Assets_Returns_10_Results() { // arrange var dbName = Guid.NewGuid().ToString(); var db = GetMemoryDb(dbName); var sut = new AssetRepository(db); var pager = new Pager(1); // act var result = sut.Find(x => x.Title.Contains("Asset"), pager); ClearMemoryDb(dbName); // assert Assert.Equal(10, result.Count()); }
public void Find_By_NotMatching_Id_Returns_0_Results() { // arrange var dbName = Guid.NewGuid().ToString(); var db = GetMemoryDb(dbName); var sut = new AssetRepository(db); var pager = new Pager(1); // act var result = sut.Find(x => x.Id == -1, pager); ClearMemoryDb(dbName); // assert Assert.Equal(0, result.Count()); }