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; }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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); }
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; }
public ProfilesController(ListsService lS) { _LS = lS; }
public ListsController() { _listsService = new ListsService(ConfigurationManager.AppSettings["ApiUri"]); }
public ListsController(ListsService lS) { _LS = lS; }
public ListsController(ListsService ls, ListTaskService lts) { _ls = ls; _lts = lts; }
public ListsController(ListsService ls, TasksService ts) { _ls = ls; _ts = ts; }
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; }