Ejemplo n.º 1
0
        public async Task ShouldSetCreatedOrUpdatedDateUtcInInsertAttribute()
        {
            var attribute = new global::Nop.Core.Domain.Common.GenericAttribute
            {
                Key = "test", KeyGroup = "test", Value = "test", CreatedOrUpdatedDateUTC = null
            };

            await _genericAttributeService.InsertAttributeAsync(attribute);

            var createdOrUpdatedDate = attribute.CreatedOrUpdatedDateUTC;

            await _genericAttributeService.DeleteAttributeAsync(attribute);

            Assert.That(createdOrUpdatedDate,
                        Is.EqualTo(DateTime.UtcNow).Within(1).Minutes);
        }
Ejemplo n.º 2
0
        public async System.Threading.Tasks.Task DeleteCronTaskAsync(int scheduleTaskId)
        {
            var ga = _genericAttributeRepository.Table
                     .FirstOrDefault(gar => gar.KeyGroup == nameof(ScheduleTask) && gar.Key == CronTasksDefaults.CronExpressionGenericAttributeKey && gar.EntityId == scheduleTaskId);

            if (ga == null)
            {
                throw new NullReferenceException("Cron task record not found");
            }

            await _genericAttributeService.DeleteAttributeAsync(ga);

            await RescheduleQuartzJobAsync(scheduleTaskId, null);
        }