Example #1
0
        public void Delete_Existing_Success()
        {
            var options = TestUtilities.GetDbContextOptions();

            var pack = new Pack {
                Name = "Test Pack111", Description = "Test Description", Language = "ru"
            };

            // Run the test against one instance of the context
            using (var context = new FillerDbContext(options))
            {
                var repo = new PackRepository(context);
                repo.InsertAsync(pack).GetAwaiter().GetResult();
                repo.DeleteAsync(pack).GetAwaiter().GetResult();
            }

            // Use a separate instance of the context to verify correct data was saved to database
            using (var context = new FillerDbContext(options))
            {
                var repo = new PackRepository(context);
                Assert.IsEmpty(repo.GetAll());
            }
        }