Пример #1
0
 public ToDoController(
     IToDoService toDoService,
     ILogger <HomeController> logger)
 {
     _toDoService = toDoService;
     _logger      = logger;
 }
Пример #2
0
 public HomeController(
     ILogger <HomeController> logger,
     IToDoService toDoService)
 {
     _logger          = logger;
     this.toDoService = toDoService;
 }
Пример #3
0
 public void OneSetUp()
 {
     _moqService          = new Mock <IToDoService>().Object;
     _mockLogger          = new Mock <ILogger <ToDoController> >().Object;
     _mockCache           = new Mock <IETagCache>().Object;
     _mockModelValidation = new Mock <ModelValidation>().Object;
 }
Пример #4
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ToDoSkill"/> class.
        /// This constructor is used for Skill Activation, the parent Bot shouldn't have knowledge of the internal state workings so we fix this up here (rather than in startup.cs) in normal operation.
        /// </summary>
        /// <param name="botState">The Bot state.</param>
        /// <param name="stateName">The bot state name.</param>
        /// <param name="configuration">The configuration for the bot.</param>
        public ToDoSkill(BotState botState, string stateName = null, Dictionary <string, string> configuration = null)
        {
            // Flag that can be used for Skill specific behaviour (if needed)
            this.skillMode   = true;
            this.toDoService = new ToDoService();

            // Create the properties and populate the Accessors. It's OK to call it DialogState as Skill mode creates an isolated area for this Skill so it doesn't conflict with Parent or other skills
            this.toDoSkillAccessors = new ToDoSkillAccessors
            {
                ToDoSkillState          = botState.CreateProperty <ToDoSkillState>(stateName ?? nameof(ToDoSkillState)),
                ConversationDialogState = botState.CreateProperty <DialogState>("DialogState"),
            };

            // Initialise dialogs
            this.dialogs = new DialogSet(this.toDoSkillAccessors.ConversationDialogState);

            if (configuration != null)
            {
                configuration.TryGetValue("LuisAppId", out var luisAppId);
                configuration.TryGetValue("LuisSubscriptionKey", out var luisSubscriptionKey);
                configuration.TryGetValue("LuisEndpoint", out var luisEndpoint);

                if (!string.IsNullOrEmpty(luisAppId) && !string.IsNullOrEmpty(luisSubscriptionKey) && !string.IsNullOrEmpty(luisEndpoint))
                {
                    var luisApplication = new LuisApplication(luisAppId, luisSubscriptionKey, luisEndpoint);
                    this.toDoSkillServices = new ToDoSkillServices
                    {
                        LuisRecognizer = new LuisRecognizer(luisApplication),
                    };
                }
            }

            this.dialogs.Add(new RootDialog(this.skillMode, this.toDoSkillServices, this.toDoSkillAccessors, this.toDoService));
        }
Пример #5
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MarkToDoTaskDialog"/> class.
        /// </summary>
        /// <param name="toDoSkillServices">The To Do skill service.</param>
        /// <param name="toDoService">The To Do service.</param>
        /// <param name="accessors">The state accessors.</param>
        public MarkToDoTaskDialog(ToDoSkillServices toDoSkillServices, IToDoService toDoService, ToDoSkillAccessors accessors)
            : base(Name, toDoSkillServices, accessors, toDoService)
        {
            var markToDoTask = new WaterfallStep[]
            {
                this.GetAuthToken,
                this.AfterGetAuthToken,
                this.ClearContext,
                this.CollectToDoTaskIndex,
                this.MarkToDoTaskCompleted,
            };

            var collectToDoTaskIndex = new WaterfallStep[]
            {
                this.AskToDoTaskIndex,
                this.AfterAskToDoTaskIndex,
            };

            // Define the conversation flow using a waterfall model.
            this.AddDialog(new WaterfallDialog(Action.MarkToDoTaskCompleted, markToDoTask));
            this.AddDialog(new WaterfallDialog(Action.CollectToDoTaskIndex, collectToDoTaskIndex));

            // Set starting dialog for component
            this.InitialDialogId = Action.MarkToDoTaskCompleted;
        }
Пример #6
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ShowToDoTasksDialog"/> class.
        /// </summary>
        /// <param name="toDoSkillServices">The To Do skill service.</param>
        /// <param name="toDoService">The To Do service.</param>
        /// <param name="accessors">The state accessors.</param>
        public ShowToDoTasksDialog(ToDoSkillServices toDoSkillServices, IToDoService toDoService, ToDoSkillAccessors accessors)
            : base(Name, toDoSkillServices, accessors, toDoService)
        {
            var showToDoTasks = new WaterfallStep[]
            {
                this.GetAuthToken,
                this.AfterGetAuthToken,
                this.ClearContext,
                this.ShowToDoTasks,
                this.AddFirstTask,
            };

            var addFirstTask = new WaterfallStep[]
            {
                this.AskAddFirstTaskConfirmation,
                this.AfterAskAddFirstTaskConfirmation,
            };

            // Define the conversation flow using a waterfall model.
            this.AddDialog(new WaterfallDialog(Action.ShowToDoTasks, showToDoTasks));
            this.AddDialog(new WaterfallDialog(Action.AddFirstTask, addFirstTask));
            this.AddDialog(new AddToDoTaskDialog(toDoSkillServices, toDoService, accessors));

            // Set starting dialog for component
            this.InitialDialogId = Action.ShowToDoTasks;
        }
Пример #7
0
 public PaginationService(
     IOptionsSnapshot <ConfigurationSettings> configurationSettings,
     IToDoService toDoService)
 {
     PageSize         = configurationSettings.Value.PageSize;
     this.toDoService = toDoService;
 }
Пример #8
0
        public ListViewModel(
            IToDoService toDoService, 
            IMessenger messenger, 
            IDispatcher dispatcher,
            ISearchService searchService,
            ISharingService sharingService
            )
        {
            _toDoService = toDoService;
            _searchService = searchService;
            _dispatcher = dispatcher;
            _messenger = messenger;
            _sharingService = sharingService;

            Items = new ObservableCollection<ToDoItem>();
            SearchResult = new ObservableCollection<ToDoItem>();

            RegisterSubscriptions();
            SetupCommands();
            
            Items.CollectionChanged += (s, c) =>
            {
                var count = Items.Count;
                Count = count;
                messenger.Send(new ItemCountChanged { Count = count });
            };
            PopulateItems();
        }
Пример #9
0
        public SidebarViewModel(IToDoService toDoService, IMessenger messenger)
        {
            _toDoService = toDoService;
            _messenger = messenger;

            AddCommand = DelegateCommand.Create(Add);
        }
Пример #10
0
        public void Setup()
        {
            _toDoService = new LocalToDoService();

            _mockList_1 = new ToDoList
            {
                Id   = Guid.NewGuid(),
                Name = "Mock List 1",
            };

            _mockList_2 = new ToDoList
            {
                Id   = Guid.NewGuid(),
                Name = "Mock List 1",
            };

            _mockItem_1 = new ToDoItem()
            {
                Id        = Guid.NewGuid(),
                Name      = "Mock Item 1",
                Completed = false
            };

            _mockItem_2 = new ToDoItem()
            {
                Id        = Guid.NewGuid(),
                Name      = "Mock Item 2",
                Completed = false
            };
        }
Пример #11
0
        public void ShouldReturn_Null_When_NoToDoItemsByToDoStatusFound()
        {
            //set up
            var toDoItem = new ToDoItem
            {
                ItemId     = 1,
                ItemTitle  = "Test To Do Item",
                ItemStatus = ToDoStatuses.InProgress,
                ItemDueOn  = DateTimeOffset.Now.AddHours(1),
                UserId     = Guid.Parse(_testUser.Id)
            };

            var mockDatabaseContext = new ToDoDbContextBuilder().UseInMemorySqlite()
                                      .WithToDoItem(toDoItem.ItemId, toDoItem.ItemTitle, toDoItem.ItemStatus, toDoItem.ItemDueOn, toDoItem.UserId).Build();

            var messageSender = new Mock <IMessageSender>();

            new Mock <IMessageSender>().Setup(i => i.SendMessage(It.IsAny <string>())).Returns(It.IsAny <Task>());

            this._toDoService = new ToDoService(mockDatabaseContext, messageSender.Object);

            // test
            var result = this._toDoService.GetItemsByStatus(_testUser, It.IsAny <ToDoStatuses>()).Result;

            // assert
            Assert.IsNotNull(result);
            Assert.AreEqual(0, result.Count);

            // messageSender.Verify(mock => mock.SendMessage(It.IsAny<string>()), Times.Never);
        }
Пример #12
0
        public void ShouldPatch_ToDoItemStatus_When_ToDoItemIsFoundForStatusPatch()
        {
            // set up
            ToDoStatuses itemStatusToPatch = ToDoStatuses.InProgress;

            var toDoItemOne = new ToDoItem
            {
                ItemId     = 1,
                ItemTitle  = "Test To Do Item One",
                ItemStatus = ToDoStatuses.ToDo,
                ItemDueOn  = DateTimeOffset.Now.AddHours(1),
                UserId     = Guid.Parse(_testUser.Id)
            };

            var mockDatabaseContext = new ToDoDbContextBuilder().UseInMemorySqlite()
                                      .WithToDoItem(toDoItemOne.ItemId, toDoItemOne.ItemTitle, toDoItemOne.ItemStatus, toDoItemOne.ItemDueOn, toDoItemOne.UserId)
                                      .Build();

            var messageSender = new Mock <IMessageSender>();

            new Mock <IMessageSender>().Setup(i => i.SendMessage(It.IsAny <string>())).Returns(It.IsAny <Task>());

            this._toDoService = new ToDoService(mockDatabaseContext, messageSender.Object);

            // test
            var toDoItem = this._toDoService.PatchItemStatus(_testUser, toDoItemOne.ItemId, itemStatusToPatch).Result;

            // assert
            Assert.IsNotNull(toDoItem);

            Assert.AreEqual(itemStatusToPatch, toDoItem.ItemStatus);

            // messageSender.Verify(mock => mock.SendMessage(It.IsAny<string>()), Times.Once);
        }
Пример #13
0
        public async Task <IActionResult> Get()
        {
            IToDoService toDoServiceClient = ServiceProxy.Create <IToDoService>(GetToDoDataServiceName(_context), null, TargetReplicaSelector.Default, listenerName: "ToDoServiceHandlerListener");

            string result = await toDoServiceClient.GetToDoListAsync().ConfigureAwait(false);

            return(new JsonResult(result));
        }
Пример #14
0
 public TodoController(IEndpointInstance endpointInstance,
                       IUserService userService,
                       IToDoService toDoService)
 {
     _endpointInstance = endpointInstance;
     _userService      = userService;
     _toDoService      = toDoService;
 }
Пример #15
0
 public AccountController(
     IAccountService iaccountService,
     IToDoService toDoService
     )
 {
     _iaccountService = iaccountService;
     _toDoService     = toDoService;
 }
Пример #16
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ToDoController"/> class.
        /// </summary>
        public ToDoController()
        {
            IDatabaseFactory factory = new DatabaseFactory();
            IToDoRepository repository = new ToDoRepository(factory);
            IUnitOfWork unitOfWork = new UnitOfWork(factory);

            this.service = new ToDoService(repository, unitOfWork);
        }
Пример #17
0
        public ToDoPrivateList()
        {
            toDoService = DependencyResolver.Kernel.Get <IToDoService>();

            InitializeComponent();

            this.DataContext = this;
        }
Пример #18
0
 public TodoController(IToDoService toDoService,
                       ILogger <TodoController> logger,
                       IIdentityService identityService)
 {
     _logger          = logger ?? throw new ArgumentNullException(nameof(logger));
     _toDoService     = toDoService ?? throw new ArgumentNullException(nameof(toDoService));
     _identityService = identityService ?? throw new ArgumentNullException(nameof(identityService));
 }
Пример #19
0
        public ListsPageModel(IToDoService toDoService, IPopupNavigation popupNavigation)
        {
            _toDoService     = toDoService;
            _popupNavigation = popupNavigation;

            CreateCommand = new Command(Create);
            DeleteCommand = new Command <ToDoList>(Delete);
        }
Пример #20
0
 public ToDoController(IEmployeeService employeeService, IGroupService groupService, IToDoService todoservice, IToDoResultService toDoResulService)
     : base(employeeService)
 {
     _employeeService  = employeeService;
     _groupService     = groupService;
     _toDoService      = todoservice;
     _toDoResulService = toDoResulService;
 }
Пример #21
0
 public ViewModelService(
     IOptionsSnapshot <ConfigurationSettings> configurationSettings,
     IToDoService toDoService,
     IToDoConverter toDoConverter)
 {
     pageSize           = configurationSettings.Value.PageSize;
     this.toDoService   = toDoService;
     this.toDoConverter = toDoConverter;
 }
Пример #22
0
 public ItemDetailViewModel(SingleChecklist checklist)
 {
     this.SingleChecklist = checklist;
     toDoService          = ServiceProvider.Instance.Get <IToDoService>();
     ExcludeCommand       = new RelayCommand <ChecklistDetail>(t => UpdateDeleteStatus(t));
     KeepCommand          = new RelayCommand <ChecklistDetail>(t => UpdateFavoriteStatus(t));
     AddCommand           = new RelayCommand(AddTask);
     DeleteCommand        = new RelayCommand <ChecklistDetail>(t => DeleteTask(t));
 }
Пример #23
0
        /// <summary>
        /// Initializes a new instance of the <see cref="GreetingDialog"/> class.
        /// </summary>
        /// <param name="toDoSkillServices">The To Do skill service.</param>
        /// <param name="toDoService">The To Do service.</param>
        /// <param name="accessors">The state accessors.</param>
        public GreetingDialog(ToDoSkillServices toDoSkillServices, IToDoService toDoService, ToDoSkillAccessors accessors)
            : base(Name, toDoSkillServices, accessors, toDoService)
        {
            // Define the conversation flow using a waterfall model.
            this.AddDialog(new WaterfallDialog(Action.Greeting, new WaterfallStep[] { this.GreetingStep }));

            // Set starting dialog for component
            this.InitialDialogId = Action.Greeting;
        }
Пример #24
0
 /// <summary>
 /// Constructor for accepting dependency injection. Dependencies are :
 /// <see cref="IToDoService"/>,
 /// <see cref="IKanbanBoardService"/>,
 /// <see cref="INoteService"/>
 /// </summary>
 public DashboardController(
     IToDoService toDoService,
     IKanbanBoardService kanbanBoardService,
     INoteService noteService
     )
 {
     _toDoService        = toDoService;
     _kanbanBoardService = kanbanBoardService;
     _noteService        = noteService;
 }
Пример #25
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ToDoSkill"/> class.
        /// </summary>
        /// <param name="toDoSkillServices">To Do skill service.</param>
        /// <param name="toDoService">To Do provider service.</param>
        /// <param name="toDoSkillAccessors">To Do skill accessors.</param>
        public ToDoSkill(ToDoSkillServices toDoSkillServices, IToDoService toDoService, ToDoSkillAccessors toDoSkillAccessors)
        {
            this.toDoSkillAccessors = toDoSkillAccessors;
            this.toDoService        = toDoService;
            dialogs = new DialogSet(this.toDoSkillAccessors.ConversationDialogState);
            this.toDoSkillServices = toDoSkillServices;

            // Initialise dialogs
            dialogs.Add(new RootDialog(skillMode, this.toDoSkillServices, this.toDoSkillAccessors, this.toDoService));
        }
Пример #26
0
        public ItemsPageModel(IToDoService toDoService, IPopupNavigation popupNavigation)
        {
            _toDoService     = toDoService;
            _popupNavigation = popupNavigation;

            CreateCommand     = new Command(Create);
            EditListCommand   = new Command(EditList);
            DeleteListCommand = new Command(DeleteList);
            EditItemCommand   = new Command <ToDoItem>(EditItem);
            DeleteItemCommand = new Command <ToDoItem>(DeleteItem);
        }
Пример #27
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RootDialog"/> class.
        /// </summary>
        /// <param name="skillMode">Skill mode.</param>
        /// <param name="toDoSkillServices">To Do skill service.</param>
        /// <param name="toDoSkillAccessors">To Do skill accessors.</param>
        /// <param name="toDoService">To Do provider service.</param>
        public RootDialog(bool skillMode, ToDoSkillServices toDoSkillServices, ToDoSkillAccessors toDoSkillAccessors, IToDoService toDoService)
            : base(nameof(RootDialog))
        {
            this.skillMode          = skillMode;
            this.toDoSkillAccessors = toDoSkillAccessors;
            this.toDoService        = toDoService;
            this.toDoSkillResponses = new ToDoSkillResponses();
            this.toDoSkillServices  = toDoSkillServices;

            // Initialise dialogs
            this.RegisterDialogs();
        }
Пример #28
0
        public ToDoAddEdit(ToDoViewModel toDoViewModel, bool isPrivate, bool isCreateProcess, bool isPopup = false)
        {
            toDoService = DependencyResolver.Kernel.Get <IToDoService>();

            InitializeComponent();

            this.DataContext = this;

            CurrentToDo     = toDoViewModel;
            IsPrivate       = isPrivate;
            IsCreateProcess = isCreateProcess;
            IsPopup         = isPopup;
        }
Пример #29
0
 public MainViewModel()
 {
     _toDoService = ServiceProvider.Instance.Get<IToDoService>();
     OpenCommand = new RelayCommand<Checklist>(t => OpenPage(t));
     AddCommand = new RelayCommand(() =>
     {
         Messenger.Default.Send("", "Add");
     });
     QueryCommand = new RelayCommand(() =>
     {
         Messenger.Default.Send("", "Query");
     });
 }
Пример #30
0
        public ToDoServiceTest()
        {
            _toDoRepositoryMock    = new Mock <IToDoRepository>();
            _userRepositoryMock    = new Mock <IUserRepository>();
            _projectRepositoryMock = new Mock <IProjectRepository>();
            _toDoService           = new ToDoService(_toDoRepositoryMock.Object, _userRepositoryMock.Object,
                                                     _projectRepositoryMock.Object);

            _toDoRepositoryMock.Setup(r => r.GetToDo(toDo1.Id)).Returns(toDo1);
            _toDoRepositoryMock.Setup(r => r.GetToDo(toDo2.Id)).Returns(toDo2);
            _userRepositoryMock.Setup(r => r.GetUser(user.Id)).Returns(user);
            _projectRepositoryMock.Setup(r => r.GetProject(project.Id)).Returns(project);
        }
        public ToDoList()
        {
            toDoService = DependencyResolver.Kernel.Get <IToDoService>();

            InitializeComponent();

            this.DataContext = this;

            Thread displayThread = new Thread(() => SyncData());

            displayThread.IsBackground = true;
            displayThread.Start();
        }
Пример #32
0
 public ToDoPage(ToDoActivity toDoActivity, TopLevelDataModel topLevelDataModel, IToDoService service)
 {
     toDoService            = service;
     this.toDoActivity      = toDoActivity;
     this.topLevelDataModel = topLevelDataModel;
     ToDo   = topLevelDataModel.ToDo;
     ToDone = topLevelDataModel.ToDone;
     InitializeComponent();
     toDoView.BindingContext = ToDo;
     DoneView.BindingContext = ToDone;
     toDoView.ItemTapped    += OnToDoItemTapped;
     DoneView.ItemTapped    += OnDoneItemTapped;
 }
Пример #33
0
 public ToDoListViewModel(IToDoService toDoService, IPageService pageService)
 {
     _toDoService               = toDoService;
     _pageService               = pageService;
     LoadDataCommand            = new Command(async() => await LoadDataAsync());
     AddToDoItemCommand         = new Command(async() => await AddToDoItemAsync());
     DeleteToDoItemCommand      = new Command <ToDoItemViewModel>(async i => await DeleteToDoItemAsync(i));
     ToggleToDoItemStateCommand = new Command <ToDoItemViewModel>(async i => await ToggleToDoItemStateAsync(i));
     RefreshDataCommand         = new Command(async() =>
     {
         await LoadDataAsync();
         IsRefreshing = false;
     });
 }
Пример #34
0
 public ToDoController(IToDoService toDoService,
     IHttpResponseHelper<ToDo, Guid> responseHelper)
 {
     _toDoService = toDoService;
     _responseHelper = responseHelper;
 }
Пример #35
0
 public ToDoController(IToDoService toDoService)
 {
     _toDoService = toDoService;
 }
        public void Setup()
        {
            _idThanksgiving = Guid.NewGuid();
            _idChristmas = Guid.NewGuid();
            _idNewYears = Guid.NewGuid();
            var todos = new List<ToDo>
            {
                new ToDo
                {
                    Id = _idThanksgiving,
                    Title = "Celebrate Thanksgiving",
                    Description = "just a test ToDo item. #1",
                    StartDate = DateTime.Parse("11/26/2015"),
                    StopDate = DateTime.Parse("11/27/2015")
                },
                new ToDo
                {
                    Id = _idChristmas,
                    Title = "Celebrate Christmas",
                    Description = "just a test ToDo item. #2",
                    StartDate = DateTime.Parse("12/24/2015"),
                    StopDate = DateTime.Parse("12/25/2015")
                },
                new ToDo
                {
                    Id = _idNewYears,
                    Title = "Celebrate New Year",
                    Description = "just a test ToDo item. #3",
                    StartDate = DateTime.Parse("12/31/2015"),
                    StopDate = DateTime.Parse("01/01/2016")
                },
            };

            _service = new MemoryOnlyToDoService(todos.ToDictionary(t=>t.Id, t => t));
        }