コード例 #1
0
        public void GetFilesFromParsedType_NoConfigFilesFound()
        {
            var typeNodeFactory = IntrospectionUtility.TypeNodeFactory <ConfigurationFileLocatorTest>();

            var configurationFileLocator = new ConfigurationFileLocator();
            var files = configurationFileLocator.GetFilesFromParsedType(typeNodeFactory);

            Assert.That(files, Is.Empty);
        }
コード例 #2
0
        public void GetFilesFromParsedType()
        {
            var orignialAssemblyLocation = GetOrignialAssemblyLocation();
            var sampleConfigLocation     = Path.Combine(orignialAssemblyLocation, "Config\\SampleConfig.xml");
            var expectedConfigLocation   = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), "config.injectioncop");
            var typeNode = IntrospectionUtility.TypeNodeFactory <ConfigurationFileLocatorTest>();

            try
            {
                File.Copy(sampleConfigLocation, expectedConfigLocation);

                var configurationFileLocator = new ConfigurationFileLocator();
                var files = configurationFileLocator.GetFilesFromParsedType(typeNode);

                Assert.That(files, Contains.Item(Path.GetFullPath(expectedConfigLocation)));
            }
            finally
            {
                File.Delete(expectedConfigLocation);
            }
        }