public BookForm(string chosenAuthor) { presenter = new BooksPresenter(this); InitializeComponent(); this.chosenAuthor = chosenAuthor; ShowInfo(); foreach (var i in books) { BooksListBox.Items.Add(i); } }
public void AddCategoriesToViewModel_WhenOnCategoriesGetDataEventIsRaised() { // Arrange var viewMock = new Mock <IBooksView>(); viewMock.Setup(v => v.Model).Returns(new BooksViewModel()); var categories = GetCategoriesWithBooks(); var categoryServiceMock = new Mock <ICategoryService>(); categoryServiceMock.Setup(c => c.GetAllCategoriesWithBooksIncluded()) .Returns(categories); BooksPresenter booksPresenter = new BooksPresenter(viewMock.Object, categoryServiceMock.Object); // Act viewMock.Raise(v => v.OnCategoriesGetData += null, EventArgs.Empty); // Assert CollectionAssert.AreEquivalent(categories, viewMock.Object.Model.Categories); }
public BooksForm() { InitializeComponent(); _presenter = new BooksPresenter(this); }