void Populate() { foreach (Button b in flowLayoutPanel1.Controls) { b.Click -= But_Click; } flowLayoutPanel1.Controls.Clear(); foreach (MBookmark b in BookmarkController.GetBookmarks()) { Button but = new Button(); but.Text = b.Name; but.AutoSize = true; but.ContextMenuStrip = contextMenuStrip1; but.FlatAppearance.BorderSize = 0; but.FlatStyle = FlatStyle.Flat; but.ImageList = imageList1; but.ImageIndex = 0; but.TextImageRelation = TextImageRelation.ImageBeforeText; but.TextAlign = ContentAlignment.MiddleRight; but.Height = 24; but.Tag = b; but.Click += But_Click; but.Parent = flowLayoutPanel1; but.Margin = new Padding(0); } }
public void GetBookmartkWithInvalidIdSouldReturnNotFound() { var ctrl = new BookmarkController(_dataServiceFacadeMock.Object, null); var response = ctrl.GetBookmarks(1); response.Should().BeOfType <NotFoundResult>(); }
public void GetBookmartkWithValidIdSouldReturnOk() { _dataServiceFacadeMock.Setup(x => x.BookmarkingDs.GetBookMark(1, "nm0000034")).Returns(new BookmarkPerson()); _mapperMock.Setup(x => x.Map <BookmarkPersonDto>(It.IsAny <BookmarkPerson>())).Returns(new BookmarkPersonDto()); var ctrl = new BookmarkController(_dataServiceFacadeMock.Object, _mapperMock.Object); ctrl.Url = _urlMock.Object; var response = ctrl.GetBookmarks(1); response.Should().BeOfType <OkObjectResult>(); }