Пример #1
0
        public async Task DoesAuthorIdExistShouldReturnFalseIfDeleted()
        {
            var options = new DbContextOptionsBuilder <AlexandriaDbContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            var db = new AlexandriaDbContext(options);

            await db.Authors.AddAsync(
                new Author
            {
                FirstName  = "first1",
                SecondName = "second1",
                LastName   = "last1",
                IsDeleted  = true,
                DeletedOn  = DateTime.UtcNow,
            });

            await db.SaveChangesAsync();

            var authorsService = new AuthorsService(db);

            var result = await authorsService.DoesAuthorIdExistAsync(1);

            Assert.False(result);
        }