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>(); }
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); }
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); }
public KanbanCreate() { InitializeComponent(); // _userService = new UserManager(new EfUserDal()); _toDoListService = new ToDoListManager(new EfToDoListDal()); _toDoItemService = new ToDoItemManager(new EfToDoItemDal()); }
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 }; }
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; }
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; }
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); }
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); }
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>(); }
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); }
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"); }
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>(); }
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; }
public ToDoController(IToDoListService service) { this.Service = service; }
public ToDoListsController(ToDoListContext context, IToDoListService toDoListService) { _context = context; _service = toDoListService; }
public MaterialNeedController(IToDoListService service) { _todoService = service; }
public CacheService(IToDoListService toDoListService) { _toDoListService = toDoListService; }
public ToDoListController(IToDoListService service, IMapper mapper) { _todoListService = service; }
public ToDoListController(IMappingService <EntityDbContext> service, IToDoListService toDoListService) { this.service = service; this.toDoListService = toDoListService; }
public ToDoItemsController(ToDoListDbContext context, IToDoListService <Guid, string> toDo) { _context = context; _toDo = toDo; }
public ToDoItemController(IToDoListService toDoListService, IUserService userService, IToDoTaskService toDoTaskService) { _toDoListService = toDoListService; _userService = userService; _toDoTaskService = toDoTaskService; }
public HomeController(IToDoListService toDoListService) { _toDoListService = toDoListService; }
public ComponentController(IToDoListService service) { _todoService = service; }
public ToSellController(IToDoListService service) { _service = service; }
public InventionController(IToDoListService service) { _service = service; }
/// <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; }
public ToDoListController(IToDoListService todoListService) { _todoListService = todoListService; }
public ToDoListController(IToDoListService service, IStaticDataService staticService) { _service = service; _staticService = staticService; }
public ToDoListController(IToDoListService service) { _service = service; }
public TaskController(ITaskService taskService, IToDoListService toDoListService) { _taskService = taskService; _toDoListService = toDoListService; }
public ProductController(IToDoListService service) { _service = service; }
public ListTasksController(IToDoListService toDoListService, IUserService userService) { _toDoListService = toDoListService; _userService = userService; }
public HomeController() { service = new ToDoListService(); }
private ToDoListController CreateSut(IToDoListService toDoListServiceFake) { return(new ToDoListController(toDoListServiceFake)); }
public IndustryController(IToDoListService todoService) { _todoService = todoService; }
/// <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; }
/// <summary> /// Parameterized Constructor with Injection of ToDoListService Class /// </summary> /// <param name="toDoListService"></param> public ToDoListItemController(IToDoListService toDoListService) { _toDoListService = toDoListService; }
public MaterialController(IToDoListService service) { _service = service; }