public void ReadAutoBundles()
        {
            var config     = ReadJson(new TestFileReader());
            var autoBundle = new AutoBundle
            {
                Id         = "full",
                OutputPath = @"bundles\auto\",
                Includes   =
                    new List <AutoBundleItem>
                {
                    new AutoBundleItem
                    {
                        Directory = @"\controllers\Root\",
                    },
                    new AutoBundleItem
                    {
                        File = "jquery-1.10.2"
                    }
                },
                Excludes         = new List <AutoBundleItem>(),
                ContainingConfig = "JsonReaderShould.ReadAutoBundles.json"
            };
            var expected = ConfigurationCreators.CreateCollectionWithAutoBundles(autoBundle);

            CustomAssert.JsonEquals(expected, config);
        }
        public void CreateSingleAutoBundleListForDifferentBundleIds()
        {
            var firstBundle = new AutoBundle
            {
                Id         = "bundleA",
                OutputPath = @"\Scripts\bundleA.js",
                Includes   = new List <AutoBundleItem> {
                    new AutoBundleItem {
                        File = "jquery"
                    }
                },
                Excludes = new List <AutoBundleItem> {
                    new AutoBundleItem {
                        File = "jquery"
                    }
                }
            };
            var secondBundle = new AutoBundle
            {
                Id         = "bundleB",
                OutputPath = @"\Scripts\bundleB.js",
                Includes   = new List <AutoBundleItem> {
                    new AutoBundleItem {
                        File = "jquery"
                    }
                },
                Excludes = new List <AutoBundleItem> {
                    new AutoBundleItem {
                        File = "jquery"
                    }
                }
            };

            var firstCollection  = ConfigurationCreators.CreateCollectionWithAutoBundles(firstBundle);
            var secondCollection = ConfigurationCreators.CreateCollectionWithAutoBundles(secondBundle);

            var merger = ConfigurationCreators.CreateDefaultConfigMerger(firstCollection, secondCollection);
            var merged = merger.GetMerged();

            var expectedCollection = ConfigurationCreators.CreateEmptyCollection();

            expectedCollection.AutoBundles.Bundles = new List <AutoBundle>
            {
                firstBundle,
                secondBundle
            };

            CustomAssert.JsonEquals(expectedCollection, merged);
        }
        public void OverrideOutputPathForAutoBundleWithSameId()
        {
            var firstBundle = new AutoBundle
            {
                Id         = "bundleA",
                OutputPath = @"\Scripts\bundleA.js",
                Includes   = new List <AutoBundleItem>(),
                Excludes   = new List <AutoBundleItem>()
            };

            var secondBundle = new AutoBundle
            {
                Id         = "bundleA",
                OutputPath = @"\Scripts\bundleB.js",
                Includes   = new List <AutoBundleItem>(),
                Excludes   = new List <AutoBundleItem>()
            };

            var firstCollection  = ConfigurationCreators.CreateCollectionWithAutoBundles(firstBundle);
            var secondCollection = ConfigurationCreators.CreateCollectionWithAutoBundles(secondBundle);

            var merger = ConfigurationCreators.CreateDefaultConfigMerger(firstCollection, secondCollection);
            var merged = merger.GetMerged();

            var expectedCollection = ConfigurationCreators.CreateEmptyCollection();

            expectedCollection.AutoBundles.Bundles = new List <AutoBundle>
            {
                new AutoBundle
                {
                    Id         = "bundleA",
                    OutputPath = @"\Scripts\bundleB.js",
                    Includes   = new List <AutoBundleItem>(),
                    Excludes   = new List <AutoBundleItem>()
                }
            };

            CustomAssert.JsonEquals(expectedCollection, merged);
        }