Пример #1
0
        public void Ctor_NullUnitOfWork_ThrowsArgumentNullException()
        {
            IUnitOfWork unitOfWork = null;
            var listRepo = new Mock<IListRepository>();
            var user = new User();

            var listService = new ListService(unitOfWork, listRepo.Object, user);
        }
Пример #2
0
        public void Ctor_Success()
        {
            var unitOfWork = new Mock<IUnitOfWork>();
            var listRepo = new Mock<IListRepository>();
            var user = new User();

            var listService = new ListService(unitOfWork.Object, listRepo.Object, user);

            Assert.IsNotNull(listService);
        }
Пример #3
0
        public ListService(IUnitOfWork unitOfWork, IListRepository listRepository, User currentUser)
        {
            Guard.NotNull<IUnitOfWork>(() => unitOfWork, unitOfWork);
            Guard.NotNull<IListRepository>(() => listRepository, listRepository);
            Guard.NotNull<User>(() => currentUser, currentUser);

            this.unitOfWork = unitOfWork;
            this.listRepository = listRepository;
            this.currentUser = currentUser;
        }
Пример #4
0
        //create a new list
        public List(string name, User owner)
        {
            Guard.NotNullOrEmpty(() => name, name);
            Guard.NotNull<User>(() => owner, owner);

            this.Name = name;
            this.Security = new List<ListSecurity>
            {
                new ListSecurity { IsActive = true, Role = ListRoleType.Owner, User= owner, LastUpdated = DateTime.Now }
            };
            this.Versions = new List<ListVersion>
            {
                new ListVersion { CreatedBy = owner }
            };
        }
Пример #5
0
 void IUserRepository.Save(User user)
 {
     throw new NotImplementedException();
 }
Пример #6
0
 /// <summary>
 /// This method will transfer ownership of a list to a new user. And update the security roles of the current owner
 /// </summary>
 /// <param name="proposedOwner"></param>
 /// <param name="proposedListSecurityForCurrentOwner"></param>
 public void TransferOwnership(User proposedOwner, ListSecurity proposedListSecurityForCurrentOwner)
 {
 }