コード例 #1
0
        public void AddFeedBacksCorrectly()
        {
            var dbContext = new DbContextOptionsBuilder <ApplicationDbContext>()
                            .UseInMemoryDatabase(Guid.NewGuid().ToString());
            var repository = new EfDeletableEntityRepository <FeedBack>(new ApplicationDbContext(dbContext.Options));

            repository.SaveChangesAsync().GetAwaiter().GetResult();

            var service = new FeedBackService(repository);

            _ = service.AddAsync("Stamat", 10, "Beshe gotino");
            var list = service.GetAllFeedBacks().ToList();

            Assert.Single(list);
            Assert.Equal(10, list[0].Rating);
            Assert.Equal("Beshe gotino", list[0].Comment);
        }