public async Task BuildAsync_WhenDashboardIsNull_ThrowsArgumentNullException()
        {
            IDashboardSettings dashboardSettings = CreateDashboardSettings();

            IDashboardNewsBuilder sut = CreateSut();

            await sut.BuildAsync(dashboardSettings, null);
        }
        public async Task BuildAsync_WhenCalledAndExceptionOccurs_AssertHandleAsyncWasCalledOnExceptionHandler()
        {
            IDashboardSettings dashboardSettings = CreateDashboardSettings();
            IDashboard         dashboard         = CreateDashboard();

            Exception             exception = new Exception();
            IDashboardNewsBuilder sut       = CreateSut(provokedException: exception);

            await sut.BuildAsync(dashboardSettings, dashboard);

            _exceptionHandlerMock.Verify(m => m.HandleAsync(It.Is <Exception>(ex => ex == exception)), Times.Once);
        }
        public async Task BuildAsync_WhenCalled_AssertReplaceWasCalledOnDashboardWithNews()
        {
            IEnumerable <INews> news = BuildNews(_random.Next(25, 75));

            IDashboardSettings dashboardSettings = CreateDashboardSettings();
            Mock <IDashboard>  dashboardMock     = CreateDashboardMock();

            IDashboardNewsBuilder sut = CreateSut(news);

            await sut.BuildAsync(dashboardSettings, dashboardMock.Object);

            dashboardMock.Verify(m => m.Replace(It.Is <IEnumerable <INews> >(value => value == news)), Times.Once);
        }
        public async Task BuildAsync_WhenCalled_AssertGetNewsAsyncWasCalledOnNewsLogic()
        {
            int numberOfNews = _random.Next(25, 75);

            IDashboardSettings dashboardSettings = CreateDashboardSettings(numberOfNews);
            IDashboard         dashboard         = CreateDashboard();

            IDashboardNewsBuilder sut = CreateSut();

            await sut.BuildAsync(dashboardSettings, dashboard);

            _newsLogicMock.Verify(m => m.GetNewsAsync(It.Is <int>(value => value == numberOfNews)), Times.Once);
        }