Example #1
0
        public async Task CreateAsyncShouldCreateNewWallPost()
        {
            var post        = new Post();
            var postService = new Mock <IWallPostsService>();

            postService
            .Setup(r
                   => r.CreateAsync
                       (It.IsAny <string>(), It.IsAny <PostType>(), It.IsAny <int?>(), It.IsAny <string>()))
            .Callback <string, PostType, int?, string>((c, t, a, o) =>
            {
                post.UserId         = c;
                post.PostType       = t;
                post.AssignedEntity = a;
                post.Content        = o;
            });

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                postService.Object,
                this.postRepository);

            await service
            .CreateAsync("aaa", "bbb", ListType.ToDoList, "ccc");

            Assert.Equal("ccc", post.UserId);
            Assert.Equal(PostType.NewList, post.PostType);
            Assert.Null(post.Content);
        }
 public IndexModel(
     UserManager <IdentityUser> userManager,
     ILogger <IndexModel> logger,
     ListsService listsService
     )
     : base(userManager)
 {
     this.logger       = logger;
     this.listsService = listsService;
 }
Example #3
0
        public ProjectListsViewModel(string projectId)
        {
            _listsService = DependencyService.Resolve <ListsService>();
            _projectId    = projectId;

            RefreshCommand = new AsyncCommand(RefrechListsAsync);

            EditListCommand   = new AsyncCommand <object>(EditListAsync);
            DeleteListCommand = new AsyncCommand <object>(DeleteListAsync);
            CreateListCommand = new AsyncCommand(CreateListAsync);
        }
Example #4
0
        public async Task GetByIdShouldReturnTheCorrectList()
        {
            await this.PopulateLists();

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            var list = service.GetById <TestListViewModel>(3);

            Assert.Equal("ccc", list.Title);
        }
Example #5
0
        public async Task GetByNameShouldReturnTheCorrectList()
        {
            await this.PopulateLists();

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            var list = service.GetByName <TestListViewModel>("bbb");

            Assert.Equal(2, list.Id);
        }
Example #6
0
        public CreateTaskViewModel()
        {
            _tasksService    = DependencyService.Resolve <TasksService>();
            _listsService    = DependencyService.Resolve <ListsService>();
            _projectsService = DependencyService.Resolve <ProjectsService>();
            _labelsService   = DependencyService.Resolve <LabelsService>();

            _requestId = RequestIdProvider.GetRequestId();

            CreateCommand      = new AsyncCommand(CreateTaskAsync);
            PickMembersCommand = new Command(OnPickMembersTapped);
            PickLabelsCommand  = new Command(OnPickLabelsTapped);

            DueDate = DateTime.Now.AddDays(7);
        }
Example #7
0
        public async Task ListItemUpdateShouldUpdateCorrectListItem()
        {
            await this.PopulateListItems();

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            await service.ListItemUpdate(1, "ccc");

            var item = this.listItemRepository.All().FirstOrDefault(i => i.Id == 1);

            Assert.Equal("ccc", item.Text);
        }
Example #8
0
        public async Task ListItemUpdateDoneShouldUpdateCorrectListItem()
        {
            await this.PopulateListItems();

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            await service.ListItemUpdateDone(2, "ddd", DateTime.Now);

            var item = this.listItemRepository.All().FirstOrDefault(i => i.Id == 2);

            Assert.Equal("ddd", item.DoneByUserId);
        }
Example #9
0
        public async Task GetAllShouldReturnAllLists()
        {
            await this.PopulateLists();

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            List <TestListViewModel> models = service.GetAll <TestListViewModel>().ToList();

            Assert.Equal(3, models.Count);
            Assert.Equal(1, models[0].Id);
            Assert.Equal(2, models[1].Id);
            Assert.Equal(3, models[2].Id);
        }
Example #10
0
        public async Task GetAllByTypeShouldReturnCorrectLists()
        {
            await this.PopulateLists();

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            List <TestListViewModel> models = service
                                              .GetAllByType <TestListViewModel>(ListType.ToDoList).ToList();


            Assert.Single(models);
            Assert.Equal(ListType.ToDoList, models[0].Type);
        }
Example #11
0
        public async Task GetAllDeletedShouldReturnOnlyDeletedLists()
        {
            await this.PopulateLists();

            var list = this.listRepository.All().FirstOrDefault(l => l.Id == 1);

            this.listRepository.Delete(list);
            await this.listRepository.SaveChangesAsync();

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            var resultList = service.GetAllDeleted <TestListViewModel>().ToList();

            Assert.Single(resultList);
            Assert.Equal("aaa", resultList[0].Title);
        }
Example #12
0
        public async Task DeleteListShouldDeleteCorrectListAndCorrespondingPost()
        {
            await this.PopulateLists();

            await this.PopulatePosts();

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            await service.DeleteList(3);

            var list = this.listRepository.All().FirstOrDefault(l => l.Title == "ccc");
            var post = this.postRepository.All().FirstOrDefault(p => p.Id == 3);

            Assert.Null(list);
            Assert.Null(post);
        }
Example #13
0
        public async Task AddItemToListShouldCreateNewListItem()
        {
            var listItems  = new List <ListItem>();
            var repository = new Mock <IDeletableEntityRepository <ListItem> >();

            repository
            .Setup(r => r.AddAsync(It.IsAny <ListItem>()))
            .Callback((ListItem p) => listItems.Add(p));

            var service = new ListsService(
                this.listRepository,
                repository.Object,
                this.postsService,
                this.postRepository);

            await service
            .AddItemToList(1, "aaa");

            Assert.Equal(1, listItems[0].ListId);
            Assert.Equal("aaa", listItems[0].Text);
        }
Example #14
0
        public async Task UnDeleteShouldUnDeleteCorrectList()
        {
            await this.PopulateLists();

            var list = this.listRepository.All().FirstOrDefault(l => l.Id == 2);

            this.listRepository.Delete(list);
            await this.listRepository.SaveChangesAsync();

            var service = new ListsService(
                this.listRepository,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            await service.UnDelete(2);

            var listResult = this.listRepository.All().FirstOrDefault(l => l.Id == 2);

            Assert.Equal("bbb", listResult.Title);
            Assert.False(listResult.IsDeleted);
        }
Example #15
0
        public async Task CreateAsyncShouldCreateNewList()
        {
            var lists      = new List <List>();
            var repository = new Mock <IDeletableEntityRepository <List> >();

            repository
            .Setup(r => r.AddAsync(It.IsAny <List>()))
            .Callback((List p) => lists.Add(p));

            var service = new ListsService(
                repository.Object,
                this.listItemRepository,
                this.postsService,
                this.postRepository);

            await service
            .CreateAsync("aaa", "bbb", ListType.ToDoList, "ccc");

            Assert.Equal("aaa", lists[0].Title);
            Assert.Equal("bbb", lists[0].Description);
            Assert.Equal("ccc", lists[0].CreatorId);
            Assert.Equal(ListType.ToDoList, lists[0].Type);
        }
 public ListsController(ListsService ls, ListItemsService lis)
 {
     _ls  = ls;
     _lis = lis;
 }
Example #17
0
 public ProfilesController(ListsService lS)
 {
     _LS = lS;
 }
Example #18
0
 public ListsController()
 {
     _listsService = new ListsService(ConfigurationManager.AppSettings["ApiUri"]);
 }
Example #19
0
 public ListsController(ListsService lS)
 {
     _LS = lS;
 }
Example #20
0
 public ListsController(ListsService ls, ListTaskService lts)
 {
     _ls  = ls;
     _lts = lts;
 }
 public ListsController(ListsService ls, TasksService ts)
 {
     _ls = ls;
     _ts = ts;
 }
Example #22
0
 public ProfilesController(ProfilesService service, ListsService ps)
 {
     _service = service;
     _ps      = ps;
 }
 public ProfilesController(ProfilesService ps, ListsService ls)
 {
     _ps = ps;
     _ls = ls;
 }
 public ListsController(ListsService ls)
 {
     _ls = ls;
 }
 public ListsController(ListsService service, ProfilesService ps)
 {
     _service = service;
     _ps      = ps;
 }