Пример #1
0
        public void EmptyContainerTest()
        {
            ServiceLocator.SetLocatorProvider(() => new Container(null));
            ServiceLocatorUser _newUser = new ServiceLocatorUser();

            Assert.IsNotNull(_newUser);
            _newUser.DataProcessing();
        }
Пример #2
0
        public void WrongKeyTest()
        {
            object[] _services = new object[]
            {
                Logger.LoggerInstance,
                new AdvancedLogger(),
                new NullReferenceException()
            };
            ServiceLocator.SetLocatorProvider(() => new Container(_services));
            ServiceLocatorUser _newUser = new ServiceLocatorUser();

            _newUser.DataProcessing("Random Text");
        }
Пример #3
0
        public void AdvancedLoggerLogTest()
        {
            object[] _services = new object[]
            {
                new Logger(),
                new AdvancedLogger(),
                new NullReferenceException()
            };
            ServiceLocator.SetLocatorProvider(() => new Container(_services));
            ServiceLocatorUser _newUser = new ServiceLocatorUser();

            Assert.IsNotNull(_newUser);
            _newUser.DataProcessing(typeof(AdvancedLogger).FullName);
        }
Пример #4
0
        public void AdvancedLoggerLogTest()
        {
            object[] _services = new object[]
            {
                Logger.LoggerInstance,
                new AdvancedLogger(),
                new NullReferenceException()
            };
            Logger.LoggerInstance.MemoryLog.Clear();
            ServiceLocator.SetLocatorProvider(() => new Container(_services));
            ServiceLocatorUser _newUser = new ServiceLocatorUser();

            _newUser.DataProcessing(typeof(AdvancedLogger).FullName);
            Assert.AreEqual <int>(0, Logger.LoggerInstance.MemoryLog.Count);
        }