Exemple #1
0
        public BookForm(string chosenAuthor)
        {
            presenter = new BooksPresenter(this);
            InitializeComponent();
            this.chosenAuthor = chosenAuthor;

            ShowInfo();
            foreach (var i in books)
            {
                BooksListBox.Items.Add(i);
            }
        }
Exemple #2
0
        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);
        }
Exemple #3
0
 public BooksForm()
 {
     InitializeComponent();
     _presenter = new BooksPresenter(this);
 }