public MigrationFile(TextReader fileContents, string fileName) { this.Version = -1; // So that, if it isn't set by file contents, we'll make a detectably bad migration. this._expectedSections = new List<SectionFinder> { new SectionFinder(0, "apply", s => this.Apply = s), new SectionFinder(1, "insert test data", s => this.InsertTestData = s), new SectionFinder(2, "delete test data", s => this.DeleteTestData = s), new SectionFinder(3, "unapply", s => this.Unapply = s), }; this._fileName = fileName; this.Name = fileName.UpToFirst("."); fileContents.Lines().Select(l => l.Trim()).Each(this.ParseLine); this.FinishCurrentSection(); }