private PressfordNewsContext GetContext() { var options = new DbContextOptionsBuilder <PressfordNewsContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new PressfordNewsContext(options); context.Article.Add(new Article() { Author = "Mr Pressford", Id = 1, Body = "Sample New", Title = "In Memory testing" }); context.Article.Add(new Article() { Author = "Dummy Author", Id = 2, Body = "Dummy Body", Title = "Should not be found in search result" }); context.SaveChanges(); return(context); }
public ArticleRepository(PressfordNewsContext context) { this._context = context; }