Пример #1
0
        public void CTOR_ThrowLoggedNullException_WhenNullITRSTranslationServiceIsProvided()
        {
            var mockILogger = TestHelper.MakeILogger();

            LoggedException.Logger = mockILogger.Object;

            ITRSTranslationService iTRSTranslationService = null;

            Assert.Throws <LoggedException>(() => new OnlineServicesSystem(mockILogger.Object, iTRSTranslationService));
            mockILogger.Verify(x => x.Error(It.IsAny <ArgumentNullException>(), It.IsAny <string>()), Times.Once);
        }
Пример #2
0
        public void CTOR_ThrowLoggedNullException_WhenNullInjectionIsProvided()
        {
            ILogger iLogger = null;
            ITRSTranslationService iTRSTranslationService = null;

            var mockILogger = TestHelper.MakeILogger();

            LoggedException.Logger = mockILogger.Object;

            Assert.Throws <LoggedException>(() => new TRSInternalServicesRole(iLogger, iTRSTranslationService));
            mockILogger.Verify(x => x.Error(It.IsAny <ArgumentNullException>(), It.IsAny <string>()), Times.Once);
            //TODO Times.Twice?
        }
        public TRSInternalServicesRole(ILogger logger, ITRSTranslationService Translator)
        {
            this.iLogger = logger ?? throw new LoggedException(new ArgumentNullException($"logger should not be null. {nameof(logger)} @ CTOR in OnlineServicesSystem"));

            this.Translator = Translator ?? throw new LoggedException(new ArgumentNullException($"ITRSTranslationService should not be null. {nameof(Translator)} @ CTOR in OnlineServicesSystem"));
        }