/// <summary> /// Updates an activity log type item /// </summary> /// <param name="activityLogType">Activity log type item</param> public virtual void UpdateActivityType(ActivityLogType activityLogType) { if (activityLogType == null) throw new ArgumentNullException("activityLogType"); s_logTypes.Clear(); _activityLogTypeRepository.Update(activityLogType); }
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 }; _workContext = MockRepository.GenerateMock<IWorkContext>(); _activityLogRepository = MockRepository.GenerateMock<IRepository<ActivityLog>>(); _activityLogTypeRepository = MockRepository.GenerateMock<IRepository<ActivityLogType>>(); _customerRepository = MockRepository.GenerateMock<IRepository<Customer>>(); _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(_activityLogRepository, _activityLogTypeRepository, _customerRepository, _workContext, null); }
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); }