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); }
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); }
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; }
//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 } }; }
void IUserRepository.Save(User user) { throw new NotImplementedException(); }
/// <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) { }