public async Task AddEntityWithIdKeepsId()
        {
            Guid id     = Guid.NewGuid();
            var  entity = new TestSoftDeleteEntity
            {
                Id = id
            };

            await using (_repository)
            {
                await _repository.Add(entity);
            }

            Assert.AreEqual(id, entity.Id);
        }
        public async Task AddAddsEntityAndSetsAttributes()
        {
            int startSize = await _context.SoftDeleteTable.CountAsync();

            int expectedSize = startSize + 1;
            var entity       = new TestSoftDeleteEntity();

            await using (_repository)
            {
                await _repository.Add(entity);
            }

            Assert.AreNotEqual(Guid.Empty, entity.Id);
            Assert.AreNotEqual(default(DateTime), entity.Created);
            Assert.AreNotEqual(default(DateTime), entity.Updated);
            Assert.IsFalse(entity.Deleted);
            Assert.AreEqual(expectedSize, await _context.SoftDeleteTable.CountAsync());
        }
        public void Setup()
        {
            var options = new DbContextOptionsBuilder <TestContext>()
                          .UseInMemoryDatabase(Guid.NewGuid().ToString())
                          .Options;

            _context = new TestContext(options);

            _repository = new TestSoftDeleteEntityRepository(_context);

            DateTime now = DateTime.UtcNow;

            _entity = new TestSoftDeleteEntity
            {
                Created  = now,
                Deleted  = false,
                Id       = Guid.NewGuid(),
                Updated  = now,
                Property = string.Empty
            };

            _deletedEntity = new TestSoftDeleteEntity
            {
                Created   = now.AddMinutes(-42),
                Deleted   = true,
                DeletedAt = now,
                Id        = Guid.NewGuid(),
                Updated   = now.AddMinutes(-42),
                Property  = "I'm deleted"
            };

            _context.SoftDeleteTable.Add(_entity);
            _context.SoftDeleteTable.Add(_deletedEntity);

            _listEntities = GetTestList();
            _context.SoftDeleteTable.AddRange(_listEntities);

            _context.SaveChanges();

            _repository = new TestSoftDeleteEntityRepository(_context);
        }