public DatabaseFixture() { var options = new DbContextOptionsBuilder <KeepNoteContext>() .UseInMemoryDatabase(databaseName: "NoteDB") .Options; //Initializing DbContext with InMemory context = new KeepNoteContext(options); // Insert seed data into the database using one instance of the context context.Notes.Add(new Note { NoteTitle = "Technology", NoteContent = "ASP.NET Core", NoteStatus = "Completed" }); context.SaveChanges(); context.Notes.Add(new Note { NoteTitle = "Stack", NoteContent = "DOTNET", NoteStatus = "Started" }); context.SaveChanges(); }
// Save the note in the database(note) table. public int AddNote(Note note) { //throw new System.NotImplementedException(); context.Notes.Add(note); return(context.SaveChanges()); }