示例#1
0
        public async Task <T> AddAsync(T entity)
        {
            await _dbContext.Set <T>().AddAsync(entity);

            await _dbContext.SaveChangesAsync();

            return(entity);
        }
        public async void Save_SetCreatedByProperty()
        {
            var ev = new Event() {EventId = Guid.NewGuid(), Name = "Test event" };

            _ticketManagementDbContext.Events.Add(ev);
            await _ticketManagementDbContext.SaveChangesAsync();

            ev.CreatedBy.ShouldBe(_loggedInUserId);
        }