Represents an activity log type record
Inheritance: BaseEntity
コード例 #1
0
        public void Can_save_and_load_activityLogType_with_activityLog()
        {
            var activityLogType = new ActivityLogType
            {
                SystemKeyword = "SystemKeyword 1",
                Name = "Name 1",
                Enabled = true,
            };
            activityLogType.ActivityLog.Add
                (
                    new ActivityLog()
                    {
                        Customer = GetTestCustomer(),
                        Comment = "Comment 1",
                        CreatedOnUtc = new DateTime(2010, 01, 03)
                    }
                );
            var fromDb = SaveAndLoadEntity(activityLogType);
            fromDb.ShouldNotBeNull();

            fromDb.ActivityLog.ShouldNotBeNull();
            (fromDb.ActivityLog.Count == 1).ShouldBeTrue();
            fromDb.ActivityLog.First().Comment.ShouldEqual("Comment 1");
            fromDb.ActivityLog.First().Customer.CreatedOnUtc.ShouldEqual(new DateTime(2010, 01, 01));
            fromDb.ActivityLog.First().CreatedOnUtc.ShouldEqual(new DateTime(2010, 01, 03));
        }
コード例 #2
0
        /// <summary>
        /// Deletes an activity log type item
        /// </summary>
        /// <param name="activityLogType">Activity log type</param>
        public virtual void DeleteActivityType(ActivityLogType activityLogType)
        {
            if (activityLogType == null)
                throw new ArgumentNullException("activityLogType");

            _activityLogTypeRepository.Delete(activityLogType);
            _cacheManager.RemoveByPattern(ACTIVITYTYPE_PATTERN_KEY);
        }
コード例 #3
0
 public new void SetUp()
 {
     _activityType1 = new ActivityLogType
     {
         Id = 1,
         SystemKeyword = "TestKeyword1",
         Enabled = true,
         Name = "Test name1"
     };
     _activityType2 = new ActivityLogType
     {
         Id = 2,
         SystemKeyword = "TestKeyword2",
         Enabled = true,
         Name = "Test name2"
     };
     _customer1 = new Customer
     {
         Id = 1,
         Email = "*****@*****.**",
         Username = "******",
         Deleted = false,
     };
        _customer2 = new Customer
        {
        Id = 2,
        Email = "*****@*****.**",
        Username = "******",
        Deleted = false,
        };
     _activity1 = new ActivityLog
     {
         Id = 1,
         ActivityLogType = _activityType1,
         CustomerId = _customer1.Id,
         Customer = _customer1
     };
     _activity2 = new ActivityLog
     {
         Id = 2,
         ActivityLogType = _activityType1,
         CustomerId = _customer2.Id,
         Customer = _customer2
     };
     _cacheManager = new NopNullCache();
     _workContext = MockRepository.GenerateMock<IWorkContext>();
     _webHelper = MockRepository.GenerateMock<IWebHelper>();
     _activityLogRepository = MockRepository.GenerateMock<IRepository<ActivityLog>>();
     _activityLogTypeRepository = MockRepository.GenerateMock<IRepository<ActivityLogType>>();
     _activityLogTypeRepository.Expect(x => x.Table).Return(new List<ActivityLogType> { _activityType1, _activityType2 }.AsQueryable());
     _activityLogRepository.Expect(x => x.Table).Return(new List<ActivityLog> { _activity1, _activity2 }.AsQueryable());
     _customerActivityService = new CustomerActivityService(_cacheManager, _activityLogRepository, _activityLogTypeRepository, _workContext, null, null, null, _webHelper);
 }
コード例 #4
0
        public void Can_save_and_load_activityLogType()
        {
            var activityLogType = new ActivityLogType
                               {
                                   SystemKeyword = "SystemKeyword 1",
                                   Name = "Name 1",
                                   Enabled = true,
                               };

            var fromDb = SaveAndLoadEntity(activityLogType);
            fromDb.ShouldNotBeNull();
            fromDb.SystemKeyword.ShouldEqual("SystemKeyword 1");
            fromDb.Name.ShouldEqual("Name 1");
            fromDb.Enabled.ShouldEqual(true);
        }