示例#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
文件: List.cs 项目: brunchey/BenNote
        //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
文件: List.cs 项目: brunchey/BenNote
 /// <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)
 {
 }