コード例 #1
0
        /// <summary>
        /// Scenario0: Base Scenario InMemory Database
        /// Should work for a wide range of unit tests
        /// </summary>
        /// <returns></returns>
        private static SupportTicketDbContext GetTestDbContextScenario0()
        {
            var options = new DbContextOptionsBuilder <SupportTicketDbContext>()
                          .UseInMemoryDatabase(databaseName: "GetActiveTicketsReturnsTickets")
                          .Options;
            var ctx = new SupportTicketDbContext(options);

            ctx.Tickets.Add(GetNewTicketStubEntity(1));
            ctx.Tickets.Add(GetNewTicketStubEntity(2));
            ctx.Tickets.Add(GetNewTicketStubEntity(3));
            ctx.SaveChanges();
            return(ctx);
        }