public async Task GetSystemErrorsAsync_WhenCalled_AssertGetSystemErrorsAsyncWasCalledOnExceptionRepository()
        {
            ISystemErrorLogic sut = CreateSut();

            await sut.GetSystemErrorsAsync();

            _exceptionRepositoryMock.Verify(m => m.GetSystemErrorsAsync(), Times.Once);
        }
        public async Task GetSystemErrorsAsync_WhenCalled_ExpectNoError()
        {
            ISystemErrorLogic sut = CreateSut();

            await sut.GetSystemErrorsAsync();

            _exceptionHandlerMock.Verify(m => m.HandleAsync(It.IsAny <Exception>()), Times.Never);
        }
        public async Task GetSystemErrorsAsync_WhenCalledAndExceptionOccurs_AssertHandleAsyncWasCalledOnExceptionHandler()
        {
            Exception         exception = new Exception();
            ISystemErrorLogic sut       = CreateSut(provokedException: exception);

            await sut.GetSystemErrorsAsync();

            _exceptionHandlerMock.Verify(m => m.HandleAsync(It.Is <Exception>(ex => ex == exception)), Times.Once);
        }
        public async Task GetSystemErrorsAsync_WhenCalledAndGetSystemErrorsAsyncOnExceptionRepositoryReturnsNull_ReturnsEmptyCollection()
        {
            ISystemErrorLogic sut = CreateSut(getSystemErrorsAsyncReturnsNull: true);

            IEnumerable <ISystemError> result = await sut.GetSystemErrorsAsync();

            Assert.IsNotNull(result);
            Assert.IsFalse(result.Any());
        }
        public async Task GetSystemErrorsAsync_WhenCalledAndExceptionOccurs_ReturnsEmptyCollection()
        {
            Exception         exception = new Exception();
            ISystemErrorLogic sut       = CreateSut(provokedException: exception);

            IEnumerable <ISystemError> result = await sut.GetSystemErrorsAsync();

            Assert.IsNotNull(result);
            Assert.IsFalse(result.Any());
        }
        public async Task GetSystemErrorsAsync_WhenCalledAndGetSystemErrorsAsyncOnExceptionRepositoryReturnsEmptyCollection_ReturnsEmptyCollection()
        {
            IEnumerable <ISystemError> systemErrors = BuildSystemErrors(numberOfSystemErrors: 0);
            ISystemErrorLogic          sut          = CreateSut(systemErrors: systemErrors);

            IEnumerable <ISystemError> result = await sut.GetSystemErrorsAsync();

            Assert.IsNotNull(result);
            Assert.IsFalse(result.Any());
        }
        public async Task GetSystemErrorsAsync_WhenCalledAndGetSystemErrorsAsyncOnExceptionRepositoryReturnsCollection_ReturnsEmptyCollection()
        {
            IEnumerable <ISystemError> systemErrors = BuildSystemErrors(numberOfSystemErrors: 100);
            ISystemErrorLogic          sut          = CreateSut(systemErrors: systemErrors);

            IEnumerable <ISystemError> result = await sut.GetSystemErrorsAsync();

            Assert.IsNotNull(result);
            Assert.AreEqual(100, result.Count());
            Assert.IsTrue(result.All(systemError => systemErrors.Contains(systemError)));
        }
Ejemplo n.º 8
0
        public DashboardFactory(IEnumerable <IDashboardContentBuilder> dashboardContentBuilderCollection, ISystemErrorLogic systemErrorLogic, IExceptionHandler exceptionHandler)
        {
            if (dashboardContentBuilderCollection == null)
            {
                throw new ArgumentNullException(nameof(dashboardContentBuilderCollection));
            }
            if (systemErrorLogic == null)
            {
                throw new ArgumentNullException(nameof(systemErrorLogic));
            }
            if (exceptionHandler == null)
            {
                throw new ArgumentNullException(nameof(exceptionHandler));
            }

            _dashboardContentBuilderCollection = dashboardContentBuilderCollection;
            _systemErrorLogic = systemErrorLogic;
            _exceptionHandler = exceptionHandler;
        }