public void SetUp()
        {
            // Custom options passed to DbContext
            var options = new DbContextOptionsBuilder <MediaLibraryDbContext>()
                          .UseSqlite(_connection)
                          .Options;

            // Instantiate the custom context
            var context = new MediaLibraryDbContext(options);

            // Instantiate the class to test
            _toTest = new MediaLibraryService(context);
        }
        public void SetUp()
        {
            // In-memory database only exists while the connection is open
            _connection = new SqliteConnection("DataSource=:memory:");
            _connection.Open();

            // Custom options passed to DbContext
            var options = new DbContextOptionsBuilder <MediaLibraryDbContext>()
                          .UseSqlite(_connection)
                          .Options;

            // Instantiate the custom context
            var context = new MediaLibraryDbContext(options);

            // Instantiate the class to test
            _toTest = new MediaLibraryService(context);

            // Create the schema in the database
            context.Database.EnsureCreated();
        }
        public static void ClassSetup(TestContext testContext)
        {
            // In-memory database only exists while the connection is open
            _connection = new SqliteConnection("DataSource=:memory:");
            _connection.Open();

            // Custom options passed to DbContext
            var options = new DbContextOptionsBuilder <MediaLibraryDbContext>()
                          .UseSqlite(_connection)
                          .Options;

            // Instantiate the custom context
            var context = new MediaLibraryDbContext(options);

            // Instantiate the class to test
            var service = new MediaLibraryService(context);

            // Create the schema in the database
            context.Database.EnsureCreated();

            // Add a movie
            service.Add(
                new Movie(
                    "My movie",
                    @"D:\repo\Something.stuff",
                    "2019-12-31")
                );

            // Add another movie
            service.Add(
                new Movie(
                    "My movie 2",
                    @"D:\repo\Something2.stuff",
                    "2020-12-31")
                );
        }