public void GetMigrationsInOrderTest()
        {
            //fake dates to test against
            var firstDate = DateTime.Parse("1/1/2008 1:11:00");
            var secondDate = DateTime.Parse("1/1/2008 1:12:00");
            var thirdDate = DateTime.Parse("1/2/2008 1:11:00");
            var fourthDate = DateTime.Parse("1/3/2008 1:11:00");
            var fifthDate = DateTime.Parse("1/20/2008 1:11:00");

            //random order
            var dates = new List<DateTime> { firstDate, fourthDate, fifthDate, secondDate, thirdDate };

            //create fake list to pass back
            var migrations = new List<Migration>();
            var fileNames = new List<string>();
            foreach (var date in dates)
            {
                //add migration
                migrations.Add(CreateMigrationObject(date));

                //add files
                fileNames.Add("a:\\test\\" + MakeMigrationFileNameFromDate(date, "does_not_matter"));
            }

            using (_mock.Record())
            {
                //pass back fake migration files
                Expect.Call(_fileWrapper.ReadDirectoryFilenames("a:\\test"))
                    .Return(fileNames);
            }
            using (_mock.Playback())
            {
                var migrationHelper = new MigrationHelper();
                IList<Migration> migrationsInOrder = migrationHelper.GetMigrationsInOrder("a:\\test", false, secondDate);

                Assert.IsNotNull(migrationsInOrder, "Migration list came back null");
                Assert.AreEqual(4, migrationsInOrder.Count, "Should be 4 since we filtered one out");
                Assert.AreEqual(secondDate, migrationsInOrder[0].MigrationDate, "date should come back in order");
                Assert.AreEqual(thirdDate, migrationsInOrder[1].MigrationDate, "date should come back in order");
                Assert.AreEqual(fourthDate, migrationsInOrder[2].MigrationDate, "date should come back in order");
                Assert.AreEqual(fifthDate, migrationsInOrder[3].MigrationDate, "date should come back in order");
            }
        }
        public void mock_files_and_make_sure_they_come_back_in_order()
        {
            //fake dates to test against
            var firstDate = DateTime.Parse("1/1/2008 1:11:00");
            var secondDate = DateTime.Parse("1/1/2008 1:12:00");
            var thirdDate = DateTime.Parse("1/2/2008 1:11:00");
            var fourthDate = DateTime.Parse("1/3/2008 1:11:00");
            var fifthDate = DateTime.Parse("1/20/2008 1:11:00");

            //random order
            var dates = new List<DateTime> { firstDate, fourthDate, fifthDate, secondDate, thirdDate };

            //create fake list to pass back
            var migrations = new List<Migration>();
            var fileNames = new List<string>();
            foreach (var date in dates)
            {
                //add migration
                migrations.Add(CreateMigrationObject(date));

                //add files
                fileNames.Add("a:\\test\\" + MakeMigrationFileNameFromDate(date, "does_not_matter"));
            }

            using (_mock.Record())
            {
                //pass back fake migration files
                Expect.Call(_fileWrapper.ReadDirectoryFilenames("a:\\test"))
                    .Return(fileNames);
            }
            using (_mock.Playback())
            {
                var fileIO = new MigrationHelper();
                IList<Migration> migrationsInOrder = fileIO.GetMigrationsInOrder("a:\\test", false);

                Assert.IsNotNull(migrationsInOrder, "Migration list came back null");
                Assert.AreEqual(dates.Count, migrationsInOrder.Count, "Should be equal in count");

                //make sure they are in order
                Migration previousMigration = null;
                for (int i = 0; i < migrationsInOrder.Count; i++)
                {
                    Migration migration = migrationsInOrder[i];
                    if (i == 0)
                        previousMigration = migration;

                    //they should be greater then or equal to in datetime
                    Assert.That(migration.MigrationDate, Is.GreaterThanOrEqualTo(previousMigration.MigrationDate));
                }
            }
        }