예제 #1
0
        //protected internal ILogManager LogManager { get; private set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="DependencyResolver"/> class.
        /// </summary>
        public DependencyResolver( /* ILogManager logManager, */ DependenciesConfigXml dependenciesConfig )
        {
            //this.LogManager = logManager;

            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler( this.CurrentDomain_AssemblyResolve );

            foreach ( DirectoryXml probingDirectory in dependenciesConfig.Dependencies )
            {
                this.AddProbingPath( probingDirectory.Location, probingDirectory.Recurse );
            }
        }
예제 #2
0
        public void DependenciesConfigXml_CreateInstance_Success()
        {
            // arrange
            DependenciesConfigXml config;

            // act
            config = new DependenciesConfigXml();

            // assert
            Assert.IsNotNull( config );
            Assert.IsInstanceOf<DependenciesConfigXml>( config );
        }
예제 #3
0
        public void Equals_DifferentDependenciesLength_AreNotEqual()
        {
            // arrange
            DependenciesConfigXml configOne = new DependenciesConfigXml();
            DependenciesConfigXml configTwo = new DependenciesConfigXml();
            DirectoryXml dir = new DirectoryXml();
            dir.Location = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location );
            configOne.Dependencies = new System.Collections.ObjectModel.Collection<DirectoryXml>();
            configOne.Dependencies.Add( dir );
            configTwo.Dependencies = new System.Collections.ObjectModel.Collection<DirectoryXml>();
            configTwo.Dependencies.Add( dir );
            configTwo.Dependencies.Add( dir );
            bool areEqual;

            // act
            areEqual = configOne.Equals( configTwo );

            // assert
            Assert.IsFalse( areEqual );
        }
예제 #4
0
        public void IsInitialized_DependenciesNull_ReturnFalse()
        {
            // arrange
            DependenciesConfigXml config = new DependenciesConfigXml();
            config.Dependencies = null;

            // act

            // assert
            Assert.IsFalse( config.IsInitialized );
        }
예제 #5
0
        public void IsInitialized_DependenciesInitialized_ReturnTrue()
        {
            // arrange
            DependenciesConfigXml config = new DependenciesConfigXml();
            config.Dependencies = new System.Collections.ObjectModel.Collection<DirectoryXml>();

            // act

            // assert
            Assert.IsTrue( config.IsInitialized );
        }
예제 #6
0
        public void GetHashCode_EqualObjects_SameHashCodes()
        {
            // arrange
            DependenciesConfigXml configOne = new DependenciesConfigXml();
            DependenciesConfigXml configTwo = new DependenciesConfigXml();
            DirectoryXml dir = new DirectoryXml();
            dir.Location = System.IO.Path.GetDirectoryName( System.Reflection.Assembly.GetExecutingAssembly().Location );
            configOne.Dependencies = new System.Collections.ObjectModel.Collection<DirectoryXml>();
            configOne.Dependencies.Add( dir );
            configTwo.Dependencies = new System.Collections.ObjectModel.Collection<DirectoryXml>();
            configTwo.Dependencies.Add( dir );
            int hashCodeOne, hashCodeTwo;

            // act
            hashCodeOne = configOne.GetHashCode();
            hashCodeTwo = configTwo.GetHashCode();

            // assert
            Assert.AreEqual( hashCodeOne, hashCodeTwo );
        }
예제 #7
0
        public void Equals_OtherType_AreNotEqual()
        {
            // arrange
            DependenciesConfigXml config = new DependenciesConfigXml();
            string other = "notaconfig";
            bool areEqual;

            // act
            areEqual = config.Equals( other );

            // assert
            Assert.IsFalse( areEqual );
        }
예제 #8
0
        private DependenciesConfigXml CreateMockDependenciesConfig( params string[] probingDirectories )
        {
            DependenciesConfigXml result = new DependenciesConfigXml();
            result.Dependencies = new Collection<DirectoryXml>();

            foreach ( string probingDir in probingDirectories )
            {
                DirectoryXml dirXml = new DirectoryXml();
                dirXml.Location = probingDir;
                result.Dependencies.Add( dirXml );
            }

            return result;
        }