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 NullCache();
     _workContext = MockRepository.GenerateMock<IWorkContext>();
     _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);
 }
        /// <summary>
        /// Deletes an activity log item
        /// </summary>
        /// <param name="activityLog">Activity log type</param>
        public virtual void DeleteActivity(ActivityLog activityLog)
        {
            if (activityLog == null)
                throw new ArgumentNullException("activityLog");

            _activityLogRepository.Delete(activityLog);
        }
        /// <summary>
        /// Inserts an activity log item
        /// </summary>
        /// <param name="systemKeyword">The system keyword</param>
        /// <param name="comment">The activity comment</param>
        /// <param name="customer">The customer</param>
        /// <param name="commentParams">The activity comment parameters for string.Format() function.</param>
        /// <returns>Activity log item</returns>
        public virtual ActivityLog InsertActivity(string systemKeyword, string comment, Customer customer, params object[] commentParams)
        {
            if (customer == null)
                return null;

            var activityType = this.GetActivityTypeBySystemKeyword(systemKeyword);
            if (activityType == null || !activityType.Enabled)
                return null;

			comment = comment.EmptyNull();
            comment = string.Format(comment, commentParams);
			comment = comment.Truncate(4000);

            var activity = new ActivityLog();
            activity.ActivityLogTypeId = activityType.Id;
            activity.CustomerId = customer.Id;
            activity.Comment = comment;
            activity.CreatedOnUtc = DateTime.UtcNow;

            _activityLogRepository.Insert(activity);

            return activity;
        }