Exemplo n.º 1
0
        public void EditPost_ConcurrencyInUpdateAndToDoListExists_ThrowsDbUpdateConcurrencyException()
        {
            //Arrange
            const int                    toDoListId                   = 1;
            ToDoList                     toDoList                     = CreateToDoListDefault();
            IToDoListService             toDoListServiceFake          = A.Fake <IToDoListService>();
            DbUpdateConcurrencyException dbUpdateConcurrencyException =
                new DbUpdateConcurrencyException(
                    "Update concurrency exception",
                    new List <IUpdateEntry> {
                A.Fake <IUpdateEntry>()
            });

            A.CallTo(() => toDoListServiceFake.Update(A <ToDoList> .Ignored))
            .ThrowsAsync(dbUpdateConcurrencyException);
            A.CallTo(() => toDoListServiceFake.Exists(A <int> .Ignored))
            .Returns(true);

            ToDoListController sut = CreateSut(toDoListServiceFake);

            //Act
            Func <Task <IActionResult> > action = () => sut.Edit(toDoListId, toDoList);

            //Assert
            action
            .Should()
            .Throw <DbUpdateConcurrencyException>();
        }
Exemplo n.º 2
0
        public MainForm(IToDoListService toDoListService,
                        IToDoListDao toDoListDao, IToDoTaskDao toDoTaskDao)
        {
            InitializeComponent();

            _toDoListService = toDoListService;
            _toDoListDao     = toDoListDao;
            _toDoTaskDao     = toDoTaskDao;

            Text = Constants.AppName;
            Icon = Properties.Resources.List;

            buttonPrevious.Image = Properties.Resources.Left.ResizeTo(Constants.Sizes.DefaultNavigationImageSize);
            var rightArrowImage = Properties.Resources.Left.ResizeTo(Constants.Sizes.DefaultNavigationImageSize);

            rightArrowImage.RotateFlip(RotateFlipType.Rotate180FlipY);
            buttonNext.Image = rightArrowImage;

            buttonPickDate.Text = Constants.Interface.Main.PickDate;

            _toDoListModels = _toDoListService.PopulateToDoListCache()
                              .Select(tdl => new ToDoListModel(tdl)).ToList();

            var currentList = _toDoListModels
                              .FirstOrDefault(tdlm => tdlm.Date.ToShortDateString() == DateTime.Now.ToShortDateString())
                              ?? _toDoListModels.OrderByDescending(tdlm => tdlm.Date).FirstOrDefault();

            _currentToDoList = currentList;

            var toDoListControl = new ToDoListControl(currentList, _toDoListService, _toDoListDao, _toDoTaskDao);

            flowLayoutPanel1.Controls.Add(toDoListControl);
        }
Exemplo n.º 3
0
        public void Index_ReturnOneToDoList()
        {
            //Arrange
            IToDoListService toDoListServiceFake = A.Fake <IToDoListService>();
            List <ToDoList>  toDoLists           = new List <ToDoList>
            {
                CreateToDoListDefault()
            };

            A.CallTo(() => toDoListServiceFake.ToDoLists())
            .Returns(toDoLists);

            ToDoListController sut = CreateSut(toDoListServiceFake);

            //Act
            IActionResult result = sut.Index().Result;

            //Assert
            result
            .As <ViewResult>()
            .Model
            .As <List <ToDoList> >()
            .Should()
            .HaveCount(1);
        }
Exemplo n.º 4
0
 public KanbanCreate()
 {
     InitializeComponent();
     // _userService = new UserManager(new EfUserDal());
     _toDoListService = new ToDoListManager(new EfToDoListDal());
     _toDoItemService = new ToDoItemManager(new EfToDoItemDal());
 }
Exemplo n.º 5
0
        public void EditPost_InvalidModalState_ReturnViewWithOneModelStateError()
        {
            //Arrange
            int      toDoListId = 1;
            ToDoList toDoList   = new ToDoList
            {
                Id = 1
            };

            IToDoListService toDoListServiceFake = A.Fake <IToDoListService>();

            ToDoListController sut = CreateSut(toDoListServiceFake);

            string modelStateErrorKey = "Name";

            sut.ModelState.AddModelError(modelStateErrorKey, "Name is required.");

            //Act
            IActionResult result = sut.Edit(toDoListId, toDoList).Result;

            //Assert
            result
            .As <ViewResult>()
            .ViewData
            .ModelState[modelStateErrorKey]
            .Errors
            .Should()
            .HaveCount(1);
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="AssessmentQuery"/> class.
 /// </summary>
 /// <param name="service">The service.</param>
 /// <param name="labelService">The label service.</param>
 /// <param name="todoListService">The todo list service.</param>
 public AssessmentQuery(IToDoItemService service, ILabelService labelService, IToDoListService todoListService, IUserService userService)
 {
     _todoitemService = service;
     _labelService    = labelService;
     _todolistService = todoListService;
     _userService     = userService;
     pagingDto        = new Contract.Core.Contract.PagingDTO {
         PageIndex = 0, PageSize = 0, SearchString = null
     };
 }
Exemplo n.º 7
0
 public ProfileController(IUserService userService, IUserTypeService userTypeService, IPDRService pdrS, UserManager <ApplicationUser> userManager, IHRProPersonnelRecordService ihrpro, IToDoListService todo, IActivityService actser)
 {
     this._UserService                 = userService;
     this._UserTypeService             = userTypeService;
     this._PDRService                  = pdrS;
     this._UserManager                 = userManager;
     this._HRProPersonnelRecordService = ihrpro;
     this._IToDoListService            = todo;
     this._IActivityService            = actser;
 }
Exemplo n.º 8
0
 public UserTypeController(IUserService userService, IUserTypeService userTypeService, IPDRConfigService pdrS, IHRProPersonnelRecordService ihrpro, IToDoListService todo, IActivityService actser)
 {
     this._UserService       = userService;
     this._UserTypeService   = userTypeService;
     this._IPDRConfigService = pdrS;
     //this._UserManager = userManager;
     this._HRProPersonnelRecordService = ihrpro;
     this._IToDoListService            = todo;
     this._IActivityService            = actser;
 }
Exemplo n.º 9
0
        public ToDoListControl(ToDoListModel toDoListModel, IToDoListService toDoListService, IToDoListDao toDoListDao, IToDoTaskDao toDoTaskDao)
        {
            InitializeComponent();

            _toDoListService = toDoListService;
            _toDoListModel   = toDoListModel;
            _toDoListDao     = toDoListDao;
            _toDoTaskDao     = toDoTaskDao;

            buttonNewTask.Image = Properties.Resources.TaskAdd.ResizeTo(Constants.Sizes.DefaultAddImageSize);

            SetListControl(_toDoListModel);
        }
Exemplo n.º 10
0
        public void Edit_ReceiveNullId_ReturnNotFoundStatusCode()
        {
            //Arrange
            int notFoundStatusCode = 404;
            IToDoListService   toDoListServiceFake = A.Fake <IToDoListService>();
            ToDoListController sut = CreateSut(toDoListServiceFake);

            //Act
            IActionResult result = sut.Details(null).Result;

            //Assert
            result
            .As <NotFoundResult>()
            .StatusCode
            .Should()
            .Be(notFoundStatusCode);
        }
Exemplo n.º 11
0
        public void Index_ReturnViewResult()
        {
            //Arrange
            IToDoListService toDoListServiceFake = A.Fake <IToDoListService>();

            A.CallTo(() => toDoListServiceFake.ToDoLists())
            .Returns(new List <ToDoList>());

            ToDoListController sut = CreateSut(toDoListServiceFake);

            //Act
            IActionResult result = sut.Index().Result;

            //Assert
            result
            .Should()
            .BeOfType <ViewResult>();
        }
Exemplo n.º 12
0
        public void Edit_ToDoListNotFound_ReturnNotFoundStatusCode()
        {
            //Arrange
            int toDoListId         = 1;
            int notFoundStatusCode = 404;
            IToDoListService toDoListServiceFake = A.Fake <IToDoListService>();

            A.CallTo(() => toDoListServiceFake.FindById(A <int> .Ignored))
            .Returns(System.Threading.Tasks.Task.FromResult((ToDoList)null));

            ToDoListController sut = CreateSut(toDoListServiceFake);

            //Act
            IActionResult result = sut.Edit(toDoListId).Result;

            //Assert
            result
            .As <NotFoundResult>()
            .StatusCode
            .Should()
            .Be(notFoundStatusCode);
        }
Exemplo n.º 13
0
        public void Edit_ToDoListExists_ReturnEditViewName()
        {
            //Arrange
            int              toDoListId          = 1;
            ToDoList         toDoList            = CreateToDoListDefault();
            IToDoListService toDoListServiceFake = A.Fake <IToDoListService>();

            A.CallTo(() => toDoListServiceFake.FindById(A <int> .Ignored))
            .Returns(toDoList);

            ToDoListController sut = CreateSut(toDoListServiceFake);

            //Act
            IActionResult result = sut.Edit(toDoListId).Result;

            //Assert
            result
            .As <ViewResult>()
            .ViewName
            .Should()
            .Be("Edit");
        }
Exemplo n.º 14
0
        public void DeleteConfirm_ValidToDoListId_RedirectToIndexView()
        {
            //Arrange
            int              toDoListId          = 1;
            string           toDoName            = "ToDo List Unit Test";
            IToDoListService toDoListServiceFake = A.Fake <IToDoListService>();

            A.CallTo(() => toDoListServiceFake.Remove(A <int> .Ignored))
            .Returns(toDoName);

            ToDoListController sut = CreateSut(toDoListServiceFake);

            sut.TempData = new TempDataDictionary(A.Fake <HttpContext>(), A.Fake <ITempDataProvider>());

            //Act
            IActionResult result = sut.DeleteConfirmed(toDoListId).Result;

            //Assert
            result
            .Should()
            .BeOfType <RedirectToActionResult>();
        }
Exemplo n.º 15
0
        public ToDoTaskControl(ToDoTaskModel toDoTaskModel, IToDoListService toDoListService, IToDoTaskDao toDoTaskDao)
        {
            InitializeComponent();

            _toDoListService = toDoListService;
            _toDoTaskModel   = toDoTaskModel;
            _toDoTaskDao     = toDoTaskDao;

            labelRemindBell.Image = _toDoTaskModel.ToEntity().HasValidReminder()
                ? Properties.Resources.Bell.ResizeTo(Constants.Sizes.DefaultBellSize) : null;
            labelTaskText.Text      = _toDoTaskModel.Text;
            checkBoxChecked.Checked = _toDoTaskModel.Checked;

            var contextMenu = new ContextMenu();

            contextMenu.MenuItems.Add(new MenuItem(Constants.Interface.TaskContextMenu.ToRemind,
                                                   new EventHandler(CheckUncheckReminder_Opening)));
            contextMenu.MenuItems.Add(new MenuItem(Constants.Interface.TaskContextMenu.Edit,
                                                   new EventHandler(EditItem_Opening)));
            contextMenu.MenuItems.Add(new MenuItem(Constants.Interface.TaskContextMenu.Delete,
                                                   new EventHandler(DeleteItem_Opening)));

            tableLayoutPanel1.ContextMenu = contextMenu;
        }
Exemplo n.º 16
0
 public ToDoController(IToDoListService service)
 {
     this.Service = service;
 }
Exemplo n.º 17
0
 public ToDoListsController(ToDoListContext context, IToDoListService toDoListService)
 {
     _context = context;
     _service = toDoListService;
 }
Exemplo n.º 18
0
 public MaterialNeedController(IToDoListService service)
 {
     _todoService = service;
 }
 public CacheService(IToDoListService toDoListService)
 {
     _toDoListService = toDoListService;
 }
 public ToDoListController(IToDoListService service, IMapper mapper)
 {
     _todoListService = service;
 }
Exemplo n.º 21
0
 public ToDoListController(IMappingService <EntityDbContext> service, IToDoListService toDoListService)
 {
     this.service         = service;
     this.toDoListService = toDoListService;
 }
Exemplo n.º 22
0
 public ToDoItemsController(ToDoListDbContext context, IToDoListService <Guid, string> toDo)
 {
     _context = context;
     _toDo    = toDo;
 }
Exemplo n.º 23
0
 public ToDoItemController(IToDoListService toDoListService, IUserService userService, IToDoTaskService toDoTaskService)
 {
     _toDoListService = toDoListService;
     _userService = userService;
     _toDoTaskService = toDoTaskService;
 }
Exemplo n.º 24
0
 public HomeController(IToDoListService toDoListService)
 {
     _toDoListService = toDoListService;
 }
Exemplo n.º 25
0
 public ComponentController(IToDoListService service)
 {
     _todoService = service;
 }
Exemplo n.º 26
0
 public ToSellController(IToDoListService service)
 {
     _service = service;
 }
Exemplo n.º 27
0
 public InventionController(IToDoListService service)
 {
     _service = service;
 }
Exemplo n.º 28
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ToDoListController"/> class.
 /// </summary>
 /// <param name="logger">The logger.</param>
 /// <param name="toDoListService">To do list service.</param>
 public ToDoListController(Framework.Core.ILogger logger, IToDoListService toDoListService, IMapper mapper)
 {
     _logger          = logger;
     _toDoListService = toDoListService;
     _mapper          = mapper;
 }
Exemplo n.º 29
0
 public ToDoListController(IToDoListService todoListService)
 {
     _todoListService = todoListService;
 }
Exemplo n.º 30
0
 public ToDoListController(IToDoListService service, IStaticDataService staticService)
 {
     _service = service;
     _staticService = staticService;
 }
Exemplo n.º 31
0
 public ToDoListController(IToDoListService service)
 {
     _service = service;
 }
Exemplo n.º 32
0
 public TaskController(ITaskService taskService, IToDoListService toDoListService)
 {
     _taskService     = taskService;
     _toDoListService = toDoListService;
 }
Exemplo n.º 33
0
 public ProductController(IToDoListService service)
 {
     _service = service;
 }
Exemplo n.º 34
0
 public ListTasksController(IToDoListService toDoListService, IUserService userService)
 {
     _toDoListService = toDoListService;
     _userService = userService;
 }
Exemplo n.º 35
0
 public HomeController()
 {
     service = new ToDoListService();
 }
Exemplo n.º 36
0
 private ToDoListController CreateSut(IToDoListService toDoListServiceFake)
 {
     return(new ToDoListController(toDoListServiceFake));
 }
Exemplo n.º 37
0
 public IndustryController(IToDoListService todoService)
 {
     _todoService = todoService;
 }
Exemplo n.º 38
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Mutation"/> class.
 /// </summary>
 /// <param name="labelService">The label service.</param>
 /// <param name="todoItemService">The todo item service.</param>
 /// <param name="todolistservice">The todolistservice.</param>
 public Mutation(ILabelService labelService, IToDoItemService todoItemService, IToDoListService todolistservice)
 {
     _labelService    = labelService;
     _todoItemService = todoItemService;
     _todoListService = todolistservice;
 }
Exemplo n.º 39
0
 /// <summary>
 /// Parameterized Constructor with Injection of ToDoListService Class
 /// </summary>
 /// <param name="toDoListService"></param>
 public ToDoListItemController(IToDoListService toDoListService)
 {
     _toDoListService = toDoListService;
 }
Exemplo n.º 40
0
 public MaterialController(IToDoListService service)
 {
     _service = service;
 }