コード例 #1
0
        public void ShowBooks()
        {
            var books = _bookService.GetAll();

            _menuVisualizer.ShowCollection(books);
            _outputEnvironment.Write($"\n{Resource.ChooseSomeone}: ");
            var choice = _outputEnvironment.ReadInt(1, books.Count);

            ShowDetails(books[choice - 1]);
        }
コード例 #2
0
ファイル: ClientPage.cs プロジェクト: VoBilyk/BookStore
        /// <summary>
        /// Showing clients list
        /// </summary>
        public void ShowClients()
        {
            var clients = _clientService.GetAll();

            _menuVisualizer.ShowCollection(clients);

            _outputEnvironment.Write($"{Resource.ChooseSomeone}: ");
            var choice = _outputEnvironment.ReadInt(1, clients.Count);

            ShowDetails(clients[choice - 1]);
        }
コード例 #3
0
        public void DisplayMenu_WhenDisplayMenu_ThenInvokeInvokeReadChoice()
        {
            // Arrange
            _menu.Add(" ", () => { });
            A.CallTo(() => _outputEnvironment.ReadInt(A <int> ._, A <int> ._))
            .Returns(1);

            // Act
            _menu.Display();

            // Act - Assert
            A.CallTo(() => _outputEnvironment.ReadInt(A <int> ._, A <int> ._)).MustHaveHappened();
        }
コード例 #4
0
        public void Setup()
        {
            this._logger            = A.Fake <ICustomLoggerFactory>();
            this._menuVisualizer    = A.Fake <IMenuVisualizer>();
            this._outputEnvironment = A.Fake <IOutputEnvironment>();
            this._clientService     = A.Fake <IClientService>();
            this._bookService       = A.Fake <IBookService>();
            this._commentService    = A.Fake <ICommentService>();

            A.CallTo(() => _clientService.GetAll())
            .Returns(new List <ClientDto>
            {
                new ClientDto
                {
                    CommentsId = new List <Guid> {
                        Guid.NewGuid()
                    },
                    WishedBooksId = new List <Guid> {
                        Guid.NewGuid()
                    }
                }
            });

            A.CallTo(() => _outputEnvironment.ReadInt(A <int> ._, A <int> ._)).Returns(1);

            _page = new ClientPage(
                _logger,
                _menuVisualizer,
                _outputEnvironment,
                _clientService,
                _bookService,
                _commentService);
        }